StoryBoard API Problems

I'm experimenting with StoryBoard API, and I ran into a problem. When going from my splash.lua to my game.lua, an error occurs.

Also, do my objects have to be global so they can be removed in destroyScene?

Error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Windows simulator build date: Dec  9 2011 @ 14:01:29
 
 
Copyright (C) 2009-2011  A n s c a ,  I n c .
        Version: 2.0.0
        Build: 2011.704
WARNING: Failed to find image(oldscene.jpg)
Runtime error
        ?:0: attempt to index a nil value
stack traceback:
        [C]: ?
        ?: in function '?'
        ?: in function 'gotoScene'
        ...kyle\documents\my code\corona\placeholder\splash.lua:13: in function
'_listener'
        ?: in function <?:514>
        ?: in function <?:215>

Anyone know?

?

Read your error message:

WARNING: Failed to find image(oldscene.jpg)

Not at all helpful.

I had this problem as well. I got this until I set a background image on the scene's view although there may be another root cause. i.e.:

local sceneGroup = self.view
image=display.newImage("some image")
sceneGroup:insert(image)

robmiracle is very active in the forum, and very helpful...
His reply was the first thing that came to my mind as well...

with that being said, please reproduce the error in code that you can FULLY release in the forums and I would be more than happy to help you debug. Only pieces of code sometimes just isn't enough.

I have also been able to reproduce this same error. If you have nothing in your createScene function, like as follows:

1
2
3
4
5
function scene:createScene( event )
        local screenGroup = self.view
        screenGroup.y = 44
        print( "\n2: createScene event" )
end

Thanks! I probably should have tried that earlier. The only reason I didn't do that is because I asked in the past on another thread and I was told I didn't need to, but it makes sense. Do I only put in display objects, or all (audio, etc)?

Edit: Also, do I have to make my background object global (along with most other variables) so that I can remove it in destroyScene? Or is there an easier way?

Also, I keep getting this error:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
Windows simulator build date: Dec  9 2011 @ 14:01:29
 
 
Copyright (C) 2009-2011  A n s c a ,  I n c .
        Version: 2.0.0
        Build: 2011.704
Runtime error
        error loading module 'game' from file 'c:\users\kyle\documents\my code\c
orona\makin' bank\game.lua':
        c:\users\kyle\documents\my code\corona\makin' bank\game.lua:77: '(' expe
cted near ':'
stack traceback:
        [C]: ?
        [C]: ?
        [C]: in function '

Well after posting that, guess what..... I've now encountered the same error using Storyboard with widget items.

It's funny. I have a game using Storyboard and I don't have errors. I have another app and this is blowing up all over the place.

I can reproduce it and I think I know the cause.

1
2
3
4
5
6
7
8
9
10
11
-- main.lua
 
local storyboard = require("storyboard")
 
local function showScreen4()
    storyboard.gotoScene("tab4")
end
 
b = display.newRect(10,10,60,60);
b:setFillColor(255)
b:addEventListener("tap", showScreen4)

So it's not necessarily my code. For some reason it doesn't like listeners.

Again, do I only put in display objects into the group, or all objects (audio, etc)? Also, do I have to make my background object global (along with most other variables) so that I can remove it in destroyScene? Or is there an easier way?

groups are for display objects only. No audio, or other stuff.

As for the background object, if you do a group:insert() on it, it should remove itself when the scene is destroyed.

@IKinx: Would you mind zipping up your code and submitting a bug with it attached?

http://developer.anscamobile.com/content/bug-submission

I think this may be related to a bug that was submitted earlier today, so the more angles we can look at the (possibly) same issue, the easier it will be to narrow down the source of the problem.

So as long as I put my display objects into the group, I don't have to remove them individually in destroyScene?

Basically in destroyScene I should be removing audio, timers, and others things that were paused in exitScene.

And I'll submit a bug report.

I am having the oldscene.jpg issue also...simply trying to gotoScene. In my exitScene, I have code to unhook listeners (had to modify the ui.Button with a Kill call to remove the touch event) and then remove the background and button objects from the display list via display.remove(object).

Here's what happens when I call gotoScene from within my click handler (an anonymous function...but I tried it with a standard function also):

WARNING: Failed to find image(oldscene.jpg)
Runtime error

?:0: attempt to index a nil value

stack traceback:
[C]: ?
?: in function '?'

This is my very first attempt to use the storyboard API, and it's a simple screen with a background and 4 buttons.

Any ideas would be immensely appreciated, because I am stuck and hoped to make great progress this week. :-(

-John

are you putting at least one display object into "group" in each scene?

Its possible there are errors in your scene file too.

Rob, that was it...thanks so much. I guess my "ready, fire, aim" personality is getting the best of me again. :-)

-John

views:2201 update:2012/1/1 13:29:50
corona forums © 2003-2011