trouble converting storyboard to copmposer

hi all,

i’ve tryng to convert a game working well with storyboard. not too hard, going from one scene to the other (and vice-versa) via a reset screen.

reset screen in which i say if previous scene=scene1 goto scene2 etc…

that works well however the scene:hide - phase = “did” NEVER HAPPENS

I have printed every scene entry and i can see that it never goes through the “did” phase.

it does go through the scene:destroy  though

I triple checked the syntax for hours and found other bizarre behaviours. I noticed that problem because my enterFrame listener of scene1 was still active when in scene2. it crashed trying to apply a force to an object that didnt exist anymore. there too, I added

Runtime:removeEventListener(“enterFrame”, everyframe)

pretty much everywhere in the scene:hide (of “will” as the “did” doesnt seem to be called) and in the scene:destroy.

I did it many times etc…

no way, the enterframe listener keeps running like a mad dog.

function everyframe(event) if (vlad11.head) then         vlad11.head:applyForce( 0, -100, vlad11.head.x, vlad11.head.y ) end .. CRASH end Runtime:addEventListener("enterFrame", everyframe)

for a while I thought maybe i’m missing an ‘end’ into a set of if…then…end and maybe corona gets confused. but i checked it all .

anyone having similar problem ?

Copyright (C) 2009-2014 &nbsp;C o r o n a &nbsp; L a b s &nbsp; I n c . &nbsp; &nbsp; &nbsp; &nbsp; Version: 3.0.0 &nbsp; &nbsp; &nbsp; &nbsp; Build: 2014.2511 Platform: GT-I9300 / x64 / 6.2 / Intel(R) HD Graphics 4000 / 4.0.0 - Build 10.18.10.3379 / 2014.2511 Android WARNING: display.setStatusBarMode() not supported in the simulator for GT-I9300 device WARNING: Simulator does not support multitouch events WARNING: Simulator does not support multitouch events WARNING: The 'ads' provider (admob) is not available on the simulator createScene scene1 previous\> &nbsp; &nbsp;nil WARNING: The 'ads' library is not available on this platform. tony2 and tony22 created tony22.head.x &nbsp;28 scene1 scene:show\> &nbsp; &nbsp; &nbsp;will &nbsp; &nbsp;1 &nbsp; &nbsp; &nbsp; table: 0E336278 scene1 scene:show WILL scene1 starting Runtime:addEventListener scene1 scene:show\> &nbsp; &nbsp; &nbsp;did &nbsp; &nbsp; 1 &nbsp; &nbsp; &nbsp; table: 0E336278 scene1 scene:show DID scene1 starting Runtime:addEventListener here is tap\_reset\_level\> &nbsp; &nbsp; &nbsp; &nbsp;true &nbsp; &nbsp;true scene1 going to reset scene1 scene:hide phase\> &nbsp; &nbsp; &nbsp; &nbsp;will scene1 removeEventListener enterFrame removing celeb timer reset &nbsp;scene:create\> &nbsp; &nbsp;scene1 scene1 scene:destroy reset changeScene prior\_scene\> &nbsp;scene1 here is reset. going to \> &nbsp; &nbsp; &nbsp; scene2 createScene scene2 previous\> &nbsp; &nbsp;reset WARNING: The 'ads' library is not available on this platform. scene2 &nbsp;scene:show\> &nbsp; &nbsp; will &nbsp; &nbsp;308 scene2 show-will\> &nbsp; &nbsp; &nbsp; 2 lv1\>refreshCount\> &nbsp; &nbsp; &nbsp; 2 scene2 Runtime:addEventListener scene2 &nbsp;scene:show\> &nbsp; &nbsp; did &nbsp; &nbsp; 308 scene2 show-did\> &nbsp; &nbsp; &nbsp; &nbsp;2 scene2 Runtime:addEventListener Runtime error c:\claude\aaacorona\g20 summit-composer\scene1.lua:635: attempt to call method 'applyForce' (a nil value) stack traceback: &nbsp; &nbsp; &nbsp; &nbsp; c:\claude\aaacorona\g20 summit-composer\scene1.lua:635: in function \<c:\claude\aaacorona\g20 summit-composer\scene1.lua:630\> &nbsp; &nbsp; &nbsp; &nbsp; ?: in function \<?:221\>

If I run the Composer sample app in the SampleCode/Interface folder and I change scene1.lua to print out the will and did phases of scene:hide(), I see both print statements show up in the console log:

    Copyright © 2009-2014  C o r o n a   L a b s   I n c .
Nov 30 19:42:30.568:     Version: 3.0.0
Nov 30 19:42:30.568:     Build: 2014.2511
Nov 30 19:42:30.678: Platform: iPhone / x86_64 / 10.10 / Intel HD Graphics 4000 OpenGL Engine / 2.1 INTEL-10.0.86 / 2014.2511
Nov 30 19:42:30.888: The file sandbox for this project is located at the following folder:
        (/Users/rmiracle/Library/Application Support/Corona Simulator/Composer-5213EAAE772C8EE752E5C444F9D952BA)
Nov 30 19:42:31.135:
    1: create event
Nov 30 19:42:31.561: 1: show event, phase did
Nov 30 19:42:44.644: 1: hide event, phase will
Nov 30 19:42:44.679:
    2: create event
Nov 30 19:42:45.457: 1: hide event, phase did
Nov 30 19:42:45.489: 2: show event, phase did
Nov 30 19:42:45.489: ((destroying scene 1’s view))

The only change I made was to add:

        elseif phase == “did” then
                print(“1: hide event, phase did”)

so that I could see both phases print.  It seems to be working as I expect it too.  Can you post your scene?   Can you compare your code to the sample app?

Rob

thanks Rob.

I’m trying to reproduce using the template.
So far it works however i have a lots more things that can go wrong including enter_frame listener and physics etc…

so i’m building things inside the template until the truth will be revealed…

I’m also using function listener as I find them more user-friendly than table listener… that’s why i dropped Flash … to get a user-friendly language…

will advise

Edualc

ok, i’ve taken the template and left it to the bare minimum, what it shows is not quite my original problem however it may be the cause (or not) , I’ve left only scene1,scene2 and reset.

you will see that when clicking reset it then goes TWICE through show event, WILL and DID of the same scene. 

it doesnt happen if i go from scene1 to scene2 directly, only via reset.

Copyright (C) 2009-2014 &nbsp;C o r o n a &nbsp; L a b s &nbsp; I n c . &nbsp; &nbsp; &nbsp; &nbsp; Version: 3.0.0 &nbsp; &nbsp; &nbsp; &nbsp; Build: 2014.2511 Platform: iPhone / x64 / 6.2 / Intel(R) HD Graphics 4000 / 4.0.0 - Build 10.18.10.3379 / 2014.2511 1: create event 1: show event, phase WILL 1: show event, phase DID 1:removing previous\_scene\> &nbsp; &nbsp; &nbsp;nil -------------------------------- scene1 goto\_scene2. event.phase\> &nbsp; &nbsp; &nbsp; &nbsp;nil 1: hide event, phase WILL 2: create event 2: show event, phase WILL 1: hide event, phase DID 2: show event, phase DID 2:removing previous\_scene\> &nbsp; &nbsp; &nbsp;scene1 ((destroying scene 1's view)) scene2 goto\_reset. event.phase\> nil 2: hide event, phase WILL reset &nbsp;scene:create removing prior\_scene\> &nbsp; &nbsp; &nbsp; scene2 ((destroying scene 2's view)) 2: create event 2: show event, phase WILL 2: show event, phase WILL 2: show event, phase DID 2:removing previous\_scene\> &nbsp; &nbsp; &nbsp;reset 2: show event, phase DID 2:removing previous\_scene\> &nbsp; &nbsp; &nbsp;reset

and here is the code originally from the template. I meant here is the code stripped down that should work.

yet somehow the reset.lua makes the scene we refresh to goes TWICE through the show:will and show:did

any idea, anyone ?

If I run the Composer sample app in the SampleCode/Interface folder and I change scene1.lua to print out the will and did phases of scene:hide(), I see both print statements show up in the console log:

    Copyright © 2009-2014  C o r o n a   L a b s   I n c .
Nov 30 19:42:30.568:     Version: 3.0.0
Nov 30 19:42:30.568:     Build: 2014.2511
Nov 30 19:42:30.678: Platform: iPhone / x86_64 / 10.10 / Intel HD Graphics 4000 OpenGL Engine / 2.1 INTEL-10.0.86 / 2014.2511
Nov 30 19:42:30.888: The file sandbox for this project is located at the following folder:
        (/Users/rmiracle/Library/Application Support/Corona Simulator/Composer-5213EAAE772C8EE752E5C444F9D952BA)
Nov 30 19:42:31.135:
    1: create event
Nov 30 19:42:31.561: 1: show event, phase did
Nov 30 19:42:44.644: 1: hide event, phase will
Nov 30 19:42:44.679:
    2: create event
Nov 30 19:42:45.457: 1: hide event, phase did
Nov 30 19:42:45.489: 2: show event, phase did
Nov 30 19:42:45.489: ((destroying scene 1’s view))

The only change I made was to add:

        elseif phase == “did” then
                print(“1: hide event, phase did”)

so that I could see both phases print.  It seems to be working as I expect it too.  Can you post your scene?   Can you compare your code to the sample app?

Rob

thanks Rob.

I’m trying to reproduce using the template.
So far it works however i have a lots more things that can go wrong including enter_frame listener and physics etc…

so i’m building things inside the template until the truth will be revealed…

I’m also using function listener as I find them more user-friendly than table listener… that’s why i dropped Flash … to get a user-friendly language…

will advise

Edualc

ok, i’ve taken the template and left it to the bare minimum, what it shows is not quite my original problem however it may be the cause (or not) , I’ve left only scene1,scene2 and reset.

you will see that when clicking reset it then goes TWICE through show event, WILL and DID of the same scene. 

it doesnt happen if i go from scene1 to scene2 directly, only via reset.

Copyright (C) 2009-2014 &nbsp;C o r o n a &nbsp; L a b s &nbsp; I n c . &nbsp; &nbsp; &nbsp; &nbsp; Version: 3.0.0 &nbsp; &nbsp; &nbsp; &nbsp; Build: 2014.2511 Platform: iPhone / x64 / 6.2 / Intel(R) HD Graphics 4000 / 4.0.0 - Build 10.18.10.3379 / 2014.2511 1: create event 1: show event, phase WILL 1: show event, phase DID 1:removing previous\_scene\> &nbsp; &nbsp; &nbsp;nil -------------------------------- scene1 goto\_scene2. event.phase\> &nbsp; &nbsp; &nbsp; &nbsp;nil 1: hide event, phase WILL 2: create event 2: show event, phase WILL 1: hide event, phase DID 2: show event, phase DID 2:removing previous\_scene\> &nbsp; &nbsp; &nbsp;scene1 ((destroying scene 1's view)) scene2 goto\_reset. event.phase\> nil 2: hide event, phase WILL reset &nbsp;scene:create removing prior\_scene\> &nbsp; &nbsp; &nbsp; scene2 ((destroying scene 2's view)) 2: create event 2: show event, phase WILL 2: show event, phase WILL 2: show event, phase DID 2:removing previous\_scene\> &nbsp; &nbsp; &nbsp;reset 2: show event, phase DID 2:removing previous\_scene\> &nbsp; &nbsp; &nbsp;reset

and here is the code originally from the template. I meant here is the code stripped down that should work.

yet somehow the reset.lua makes the scene we refresh to goes TWICE through the show:will and show:did

any idea, anyone ?