StoryBoard Issues Thread : Please post any

@optionniko: Can you give me more information on your bug please?

@CSG-DEV:

It’s hard to fully understand your current issue.

From what you have told me,

  1. if your base image (smallest image) as you said is 480 x 320 then that is the size you pass to display.newImageRect
image = display.newImageRect( "2ndship.png", 480, 320)  
  1. for displaying at the corner of the screen, im not sure, as a test… to place an image in the middle of the screen do this
image = display.newImageRect( "2ndship.png", 480, 320)  
image.x = display.contentWidth \* 0.5  
image.y = display.contentHeight \* 0.5  

Always be careful what you are passing as the width and height parameters to display.newImageRect.

It goes:

display.newImageRect( image file, width, height)

so if you have these images

myimg.png (50x50), myimg@2x (100x100), myimg@4x(200x200) you always pass the size of the smallest image to display.newImageRect

display.newImageRect("myimg.png", 50, 50)  

Just one other thing, for all those not using code tags and just pasting there code as plain text, it would make it so much faster for us to help you if we can actually read the code (posting as plain text looses formatting and syntax highlighting, not to mention line numbers…

You use code tags like so:

<code>
Put your code here
</code> [import]uid: 84637 topic_id: 24131 reply_id: 103192[/import]

Thank you very much for the prompt reply. I did pass the smallest image to newImageRect as directed.
The bug is my images, instead of displaying on the whole screen were showing up in the left quadrant, and only a quarter of them where showing.
Adding the
image.x = display.contentWidth * 0.5
image.y = display.contentHeight * 0.5

Looks to have fixed it though I’m not sure why…?
As my images were sized to the screen, why does the inclusion of this code fix this issue?
I would think the images should have fit the screen as is…?
I also need, just to ensure the images are being selected correctly, I’ll slightly change the @6x image and the @4x and test on an iPad2 and iPad3.
Thanks Again! [import]uid: 100134 topic_id: 24131 reply_id: 103208[/import]

Thank you very much for the prompt reply!!!
Your help is really appreciated.

I did pass the smallest image to newImageRect as directed.
The bug is my images, instead of displaying on the whole screen were showing up in the left quadrant, and only a quarter of them where showing.
Adding the
image.x = display.contentWidth * 0.5
image.y = display.contentHeight * 0.5

Looks to have fixed it though I’m not sure why…?
As my images were sized to the screen, why does the inclusion of this code fix this issue?
I would think the images should have fit the screen as is…?
I also need, just to ensure the images are being selected correctly, I’ll slightly change the @6x image and the @4x and test on an iPad2 and iPad3.

UPDATE: I tested the code on an iPhone4S, IPad2 and iPad3. I have the following images,
image, image@2x, image@4x and image@6x. (
The files are 480?×?320, 960?×?640, 1024x768 and 2048?×?1536
The iPhone4S and the iPad2 incorrectly received the same image, (960x640). The ipad2 should have received the 1027x768 image. The ipad3 received the image that in my opinion should have gone onto the iPad2 as the ipad3 received the 1024x768 image.

So i have 2 remaining questions, why aren’t the images scaling to the 4 IOS resolutions and why is centering the images required.

Here is the relevant code.

1 image = display.newImageRect( "2ndship.png", 480, 320)  
2 image.x = display.contentWidth \* 0.5   
3 image.y = display.contentHeight \* 0.5  
4 screenGroup:insert( image )  

Here again is my config.lua

  
1 application = {  
2 content = {  
3 width = 320,  
4 height = 480,   
5 scale = "letterBox",  
6 fps = 30,  
7   
8 imageSuffix =  
9 {  
10 ["@2x"] = 2, -- for iphone 4  
11 ["@4x"] = 4, -- for ipad 2  
12 ["@6x"] = 6, -- for iPad 3  
13 }  
14   
15 }  
16 }  

Thanks Again! [import]uid: 100134 topic_id: 24131 reply_id: 103209[/import]

Hy Danny,

Here’s my issue:

When i’m transitioning from a scene that’s quite heavy, that scene somethimes turns blank while transitioning. I’m only using ‘slideRight’ and ‘slideLeft’.

My understanding is that when transitioning away from a heavy scene, that scene gets completely wipedout just before transition starts to freeup the memory. I’m i right?

And i would also like to add that i’ve noticed this behaviour started to appear in around build 782 (not exactly sure if 782 or somewhere near 782).

And this issue doesn’t appear on the simulator, only on a device.

Thanks again Danny!
Nick [import]uid: 77183 topic_id: 24131 reply_id: 103277[/import]

Is this me, corona or storyboard?
I got this piece of code that should work but storyboard does not like it:
I am using imagesheets and am disposing of them the following way:

 boomBloesemAnim1:removeSelf( )  
 boomBloesemAnim1=nil  
 boomBloesemAnim2:removeSelf( )  
 boomBloesemAnim2=nil  
 boomBloesemAnim3:removeSelf( )  
 boomBloesemAnim3=nil  
 boomBloesemAnim4:removeSelf( )  
 boomBloesemAnim4=nil  
 boomBloesemAnim5:removeSelf( )  
 boomBloesemAnim5=nil  
 boomBloesemAnim6:removeSelf( )  
 boomBloesemAnim6=nil  
 boomBloesemAnim7:removeSelf( )  
 boomBloesemAnim7=nil  
  
 boomBloesemImageSheet=nil  

Problem is this does not work Storyboard gives the great error that it cannot go to a scene that does not exist blah blah. When I go to the scene that has this code.
If I comment out any nil-removeSelf pair it works. Does not matter which one.
So if I remove 6 it works any 6. If I try to remove 7 it gives me the error.
Driving me nuts. What am I missing. Using build 782 with storyboard. [import]uid: 100901 topic_id: 24131 reply_id: 103363[/import]

Is the issue of using transitions with scenes that have objects bleeding outside the viewable area going to be resolved? I.E., a universal app at 640x960 might have full-width art that’s 720 px wide to fill the letterbox area of an iPad. This little sliver still makes slide* transitions a bit ugly as that letterbox sliver pops over the new scene before blinking out. [import]uid: 44647 topic_id: 24131 reply_id: 105417[/import]

Due to last update to storyboard, scene.view.xOrigin cannot be used to make universal builds for iphone and ipad (791 i supose).

Does one additional newGroup() on the top of all objects per each scene would be good workaround without penalty to performance ?

 -- scene group, create scene function  
 screenGroup = display.newGroup()  
 screenGroup.x = Game.iPadX   
 scene.view:insert(screenGroup)  

where Game.iPadX is 32 for iPad and 0 for rest

What about further plans for storyboard ? Can i implement this without being pushed to modify it once again in near future ?

Tom [import]uid: 111283 topic_id: 24131 reply_id: 106315[/import]

Hi everybody,

I just wanted to note here that the storyboard.removeAll() API seems to have been broken as of daily build #812 - calling the API in earlier builds works as expected, but builds 812 & 813 throw up a runtime error in the terminal window, and no scenes are purged or removed from memory. Storyboard still seems to be removing scenes when it gets a low memory warning, but if you use the removeAll API, you should be aware of this bug.

I’ve filed an official bug report (case # 14243)

Thanks,
Jason [import]uid: 27636 topic_id: 24131 reply_id: 106327[/import]

I confirm the error toby2 is seeing. It happens for removeAll() and also for removeScene() if you are calling removeScene() from the same scene you are trying to remove. I was using 100ms delay for that until 812 without problem, now it needs 1000ms delay at least. I have another thread open for this. [import]uid: 19297 topic_id: 24131 reply_id: 106344[/import]

Hey,

I’ve been using build 797 and now build 813, and I’ve encountered an issue with transitioning to an overlay. Like the problem there was before with transitioning between scenes, there is a noticeable delay when transitioning to overlays on device, even when I’m using no effects.

On the simulator it’s almost unnoticeable, but when it runs on the device it’s between 500ms and 1000ms delay (this is a Galaxy Nexus I’m running it on), which is quite long.

Also, the [lua]storyboard.hideOverlay( true )[/lua] function call seems to be ignoring my use of the [lua]purgeOnly[/lua] bool, and is just destroying my overlay anyway.

Any help/explanations/work-arounds would be greatly appreciated.

Thanks,
Ashok [import]uid: 56979 topic_id: 24131 reply_id: 106409[/import]

@Bladko: The approach you suggested is the recommended approach when it comes to moving the entire group, which is to create a sub-group within the view and manipulate that instead. You’ll find that manipulating the view directly can often result in issues and conflicts with scene transition effects. So to re-iterate, yes, you’ll be fine creating a sub-group within the view, placing everything in that and manipulating the sub-group instead.

@jasonschroeder: Casenum 14243 has been resolved and should appear in build 2012.815.

@asQuirreL: As far as the delay goes, do you experience it even with overlays with relatively little content in them? Could the delay be caused by having a “heavy” scene that needs to be created? As far as the other issues you mentioned go, I’m looking into them right now and should have an update for you soon.

Thanks everyone.
[import]uid: 52430 topic_id: 24131 reply_id: 106932[/import]

@asQuirreL: I investigated the “purgeOnly not working” issue with overlays you were describing and I couldn’t reproduce it with the changes that just got pushed in—so the issue appeared to be related to the storyboard.removeScene() and storyboard.removeAll() bugs that were just fixed.

In my test, I put a print statement in scene2.lua (the overlay) outside of event listeners, so it would only be executed when the module is loaded (so only if it was previously removed), and once I called storyboard.showOverlay() on it a second time, the print statement did not show when purgeOnly was set to ‘true’ (though it showed a second time when the purgeOnly flag was left out). [import]uid: 52430 topic_id: 24131 reply_id: 106933[/import]

@jonathanbeebe

Thanks for the quick response. I’ll look at that fix, hopefully that’ll solve the issue for me. I checked whether it was a heavy scene, and I didn’t think it was, I took out quite a few of the heavy hitters when it came to loading in to memory, so it was only 3 images and a rect on screen, and it still had the same issue.

Right now I’m working on a system to cache image sheets, so they don’t have to keep being called up, hopefully that might ease most of the load. [import]uid: 56979 topic_id: 24131 reply_id: 107085[/import]

Not sure if this was already mentioned but I since I couldn’t find anything related to this here it is. Seems like transitions that move the scenes like slideLeft and slideRight don’t work correctly when scaling mode is set to letterbox (probably others too) and the scene uses the entire screen (objects outside the “black bars” or images that use the entire screen width and height). Objects outside the resolution set in config.lua or that are outside the screen can be seen over the next scene.

How to reproduce (Corona build 817):

  1. Set config.lua to 320x480 and letterbox scaling.
  2. Create 2 scenes both with a background image that fills the entire screen so that no black bars can be seen in either scene even when the sim skin is set to iPad or any of the Android skins.
  3. Create a button on each scene that will transition from one to the other, one using slideLeft the other slideRight.
  4. Run it on the sim with iPad skin or any Android skin and you will notice that the transition is not smooth.
  5. Add some objects that go beyond the screen boundaries so that part of it is visible and part is hidden outside the sides of the screen.
  6. Run again and you will see those objects over part of the next scene during the transition.

I can provide sample code if needed.

Andre
[import]uid: 10048 topic_id: 24131 reply_id: 107472[/import]

Having same problem here (build 820)

Storyboard transitions (slideLeft, slideRight) does not work correct with letterbox scaling in landscape mode on android

Altered storyboard sample code is showing same problem
[import]uid: 61847 topic_id: 24131 reply_id: 108231[/import]

@arbt/remco: Sounds like a legitimate bug. Please submit a bug report with a sample project demonstrating the issue. Thanks!

http://developer.anscamobile.com/content/bug-submission [import]uid: 52430 topic_id: 24131 reply_id: 108324[/import]

Filed bug. It has been logged as case #14486. [import]uid: 10048 topic_id: 24131 reply_id: 108330[/import]

I think I’ve found a bug with the events using the overlay feature. I’ve tested this in version 777, 807 and 821.

When calling storyboard.hideOverlay(), the scene used as overlay dispatches the “exitScene” event when the “didExitScene” should have been dispatched (after the scene transition effect that is), and the “didExitScene” never dispatches. [import]uid: 132258 topic_id: 24131 reply_id: 108483[/import]

@marcusthunstrom: Thanks for pointing that issue out to us. We were able to fix the bug, and the changes should be in the next daily build. [import]uid: 52430 topic_id: 24131 reply_id: 108682[/import]

[SOLVED] I filed the test project to bug report, and Ansca team got back to me, showing what was wrong with my implementation. The problem was, beamGroup needed to be forward referenced, but the beamGroup = display.newGroup() had to be inside the createScene function. It makes really good sense – and I should’ve known that, but somehow I didin’t see it. Also, beamGroup needed to be nilled upon exitScene (and I never thought of doing so with displayGroup.)

I’ve edited the code below with comment showing what was wrong and how it was fixed.

Thank you, Ansca Team!

Naomi


Using daily build 828, I have set up a very simple test project that has two scenes: menu.lua and game.lua

On both menu and game scenes, I create a simple animation using transition.to , and when I launch the project and come to menu.lua, it looks and works as expected.

When I tap on a button to leave menu scene and come to game scene, it also looks and works as expected.

However, when I tapp on “go back” button on game scene and return to menu scene, I get this dreadful runtime error (on line 42 of the menu.lua code below):
bad argument #-1 to ‘_newImageRect’ (Proxy expected, got nil)

Am I doing something wrong? Or is this Storyboard bug? Here are the code for menu and game scenes. I think when I return to menu.lua from game.lua, it is unable to insert the image to beamGroup. (I don’t understand why it is able to do this first time around but not the second time around.)

Naomi

menu.lua:

local widget = require( "widget" )  
local storyboard = require( "storyboard" )  
storyboard.isDebug = true  
storyboard.purgeOnSceneChange = true  
  
local scene = storyboard.newScene()  
local localGroup  
--local beamGroup = display.newGroup(); \<\< this was wrong  
local beamGroup  
local img = {}  
img.bgBeam = {}  
local btnSheetOption  
local btnSheet  
local playGame  
  
local function changeScene( self, event )  
 storyboard.gotoScene( "game", "crossFade", 400 )  
end  
  
---------------------------------------------------------------------------------  
-- rotate beam  
---------------------------------------------------------------------------------  
function img.rotateAgain()  
 img.rotateStart = nil;  
 beamGroup.rotation = 0  
 img.rotateBeam()  
end  
function img.rotateBeam()  
 img.rotateStart = transition.to(beamGroup, {time = 60000,   
rotation = 360, onComplete=img.rotateAgain})  
end  
  
---------------------------------------------------------------------------------  
-- Scene functions  
---------------------------------------------------------------------------------  
  
-- Called when the scene's view does not exist:  
function scene:createScene( event )  
  
 localGroup = self.view  
 -- create display group here (not outside the createScene)  
 beamGroup = display.newGroup()   
  
 for i=1,18 do  
 img.bgBeam[i] = display.newImageRect( beamGroup, "PNG/beam.png", 40, 320 )  
 img.bgBeam[i]:setReferencePoint(display.TopCenterReferencePoint)  
 img.bgBeam[i].x = 0; img.bgBeam[i].y = 0;  
 if (i == 1) then  
 img.bgBeam[i].rotation = 20;  
 else  
 img.bgBeam[i].rotation = img.bgBeam[i-1].rotation+20;  
 end  
 end  
 beamGroup.x = 240; beamGroup.y = 180;  
 localGroup:insert(beamGroup);  
  
 btnSheetOption = {  
 width = 200,   
 height = 60,  
 numFrames = 2,  
 sheetContentWidth = 200,  
 sheetContentHeight = 120  
 };  
 btnSheet = graphics.newImageSheet( "PNG/rect.png", btnSheetOption )  
  
 playGame = widget.newButton{  
 sheet = btnSheet,  
 defaultIndex = 1,  
 overIndex = 2,  
 width = 200,  
 height = 60,  
 label = "PLAY GAME",  
 labelColor = { default={255}, over={255} },  
 fontSize = 20,  
 onRelease = changeScene,  
 emboss = true  
 }  
 playGame.x = 240;  
 playGame.y = 180;  
 localGroup:insert(playGame);   
  
 collectgarbage("collect")  
end  
-- Called immediately after scene has moved onscreen:  
function scene:enterScene( event )  
  
 -- previous scene's view is purged by   
 -- storyboard.purgeOnSceneChange = true;  
  
 img.rotateBeam()  
  
end  
  
-- Called when scene is about to move offscreen:  
function scene:exitScene( event )  
  
 -- cancel transition  
 if (img.rotateStart) then transition.cancel(img.rotateStart) end  
  
 -- remove display object that uses imageSheet  
 display.remove( playGame ); playGame = nil;  
  
 -- remove reference to the imageSheet  
 btnSheet = nil;  
  
 beamGroup = nil; -- nil out the display group here  
  
end  
  
function scene:didExitScene( event )  
end  
  
function scene:destroyScene( event )  
end  
  
---------------------------------------------------------------------------------  
-- END OF YOUR IMPLEMENTATION  
---------------------------------------------------------------------------------  
  
-- "createScene" event is dispatched if scene's view does not exist  
scene:addEventListener( "createScene", scene )  
  
-- "enterScene" event is dispatched whenever scene transition has finished  
scene:addEventListener( "enterScene", scene )  
  
-- "exitScene" event is dispatched before next scene's transition begins  
scene:addEventListener( "exitScene", scene )  
  
-- "destroyScene" event is dispatched before view is unloaded, which can be  
-- automatically unloaded in low memory situations, or explicitly via a call to  
-- storyboard.purgeScene() or storyboard.removeScene().  
scene:addEventListener( "destroyScene", scene )  
  
scene:addEventListener( "didExitScene", scene )  
  
---------------------------------------------------------------------------------  
  
return scene  

game.lua

[code]
local widget = require( “widget” )
local storyboard = require( “storyboard” )
storyboard.isDebug = true;
storyboard.purgeOnSceneChange = true;

local scene = storyboard.newScene()
local localGroup;
–local beamGroup = display.newGroup(); << this was wrong
local beamGroup
local img = {};
img.bgBeam = {};
local btnSheetOption;
local btnSheet;
local goBack;

local function changeScene( self, event )
storyboard.gotoScene( “menu”, “crossFade”, 400 )
end


– rotate beam

function img.rotateAgain()
img.rotateStart = nil;
beamGroup.rotation = 0
img.rotateBeam()
end
function img.rotateBeam()
img.rotateStart = transition.to(beamGroup, {time = 60000,
rotation = 360, onComplete=img.rotateAgain})
end


– Scene functions

– Called when the scene’s view does not exist:
function scene:createScene( event )

localGroup = self.view
– create display group here (not outside the createScene)
beamGroup = display.newGroup()

for i=1,18 do
img.bgBeam[i] = display.newImageRect( beamGroup, “PNG/beam.png”, 40, 320 )
img.bgBeam[i]:setReferencePoint(display.TopCenterReferencePoint)
img.bgBeam[i].x = 0; img.bgBeam[i].y = 0;
if (i == 1) then
img.bgBeam[i].rotation = 20;
else
img.bgBeam[i].rotation = img.bgBeam[i-1].rotation+20;
end
end
beamGroup.x = 240; beamGroup.y = 180;
localGroup:insert(beamGroup);

btnSheetOption = {
width = 200,
height = 60,
numFrames = 2,
sheetContentWidth = 200,
sheetContentHeight = 120
};
btnSheet = graphics.newImageSheet( “PNG/rect.png”, btnSheetOption )

goBack = widget.newButton{
sheet = btnSheet,
defaultIndex = 1,
overIndex = 2,
width = 200,
height = 60,
label = “GO BACK”,
labelColor = { default={255}, over={255} },
fontSize = 20,
onRelease = changeScene,
emboss = true
}
goBack.x = 240;
goBack.y = 180;
localGroup:insert(goBack);
end

– Called immediately after scene has moved onscreen:
function scene:enterScene( event )

img.rotateBeam()

– previous scene’s view is purged by
– storyboard.purgeOnSceneChange = true;

end
– Called when scene is about to move offscreen:
function scene:exitScene( event )

– cancel transition
if (img.rotateStart) then transition.cancel(img.rotateStart) end

– remove display object that uses imageSheet
display.remove( goBack ); goBack = nil;

– remove reference to the imageSheet
btnSheet = nil;

beamGroup = nil; – nil out the display group here

end

function scene:didExitScene( event )
end
– Called prior to the removal of scene’s “view” (display group)
function scene:destroyScene( event )
end


– END OF YOUR IMPLEMENTATION

– “createScene” event is dispatched if scene’s view does not exist
scene:addEventListener( “createScene”, scene )

– “enterScene” event is dispatched whenever scene transition has finished
scene:addEventListener( “enterScene”, scene )

– “exitScene” event is dispatched before next scene’s transition begins
scene:addEventListener( “exitScene”, scene )

– “destroyScene” event is dispatched before view is unloaded, which can be
– automatically unloaded in low memory situations, or explicitly via a call to
– storyboard.purgeScene() or storyboard.removeScene().
scene:addEventListener( “destroyScene”, scene )

scene:addEventListener( “didExitScene”, scene )


return scene
[/code] [import]uid: 67217 topic_id: 24131 reply_id: 111459[/import]