storyboard - how/where to add/remove listeners for a button widget in storyboard?

If you create a display object:

[lua]

    button = display.newImageRect(…)

    local function fred(event)

        …

    end

    button:addEventListener(“touch”, fred)

    group:insert(button)

[/lua]

in either createScene or enterScene and you add it to the scene’s view, i.e. group:insert… then when the scene is transitioned away, that button is no longer on screen so it can’t be interacted with.  When the scene is purged or removed, those objects are destroyed.  The event handler itself is just a function in code, it it doesn’t really get destroyed, but the objects isn’t there so there is no way to trigger the event.  So yes, your a) assumption is right sort of.  You don’t have to deal with it, but when the process that calls destroyScene() is running, your objects go away.

I’m not completely sure I follow what you mean by “Caching approach”, but if you mean that we keep the scene in memory in case you come back to it, when those objects transition back on screen, you can interact with them again and the existing event listeners you added when the object was first created are still there and functioning. 

thanks Rob (for bearing with me)

So it’s true to say then whilst the original storyboard tutorials (e.g. http://www.coronalabs.com/blog/2011/11/14/introducing-the-storyboard-api/ ) highlighted removing listeners in the “exitScene” event, in fact you don’t really need to do this for non-Runtime listeners (e.g. display objects).   So in all my scene’s I could pretty much remove these “removeEventListener” lines for my display objects and save some code correct?

Also there would be no issues then either adding the display object listeners in createScene if you wanted, instead of enterScene  then too correct?  (otherwise you’d be added them back in each enterScene when you wouldn’t have needed to, because they wouldn’t have been removed)

Hi Brent, Dr. Burton, Saer, And all my friends at Corona Forum

I am working now on my book finally!!!

See, I told you, I did not needed a lot of things to start working, it’s a simple book for children.

I have the storyboard working, I have so far 4 pages, the home and the main.

I can add pages, make simple animation, and I can add sound to the buttons.

So I’m really happy because now I can keep learning more, but start making my app now

Thank you for all your help, thanks Dr. Burton for your book.


One question, I think it’s very important…

Once I finish my book which it’s for the iPad ONLY, and I can see the final book in the Corona Simulator in my Mac…

what I see in my computer will be the same, and it will look and behave exactly the same as in a REAL iPAD?


And one more…

About money – I have to pay $99.00 per year to Apple for the developer program to upload my app to the app store

to see if they accept it, right?

And how much money do I have to pay to Corona for using the program?

Is there any more fees or money involved?


Thank you for everything.

Let’s see how long it takes me to write my book

Victor

Thank you everyone for helping me, THANK YOU VERY MUCH!

I’m learning little by little, but I’m almost there to start making my books.

One more question – I’m adding a video to try to explaing the question better

http://www.youtube.com/watch?v=waa_Troorf4&feature=youtu.be

Thank you again for all your help.

I got the sound –

the storyboard –

the animation –

the background –

Good!

Victor

Hi Brent, Dr. Burton, Saer, And all my friends at Corona Forum

I am working now on my book finally!!!

See, I told you, I did not needed a lot of things to start working, it’s a simple book for children.

I have the storyboard working, I have so far 4 pages, the home and the main.

I can add pages, make simple animation, and I can add sound to the buttons.

So I’m really happy because now I can keep learning more, but start making my app now

Thank you for all your help, thanks Dr. Burton for your book.


One question, I think it’s very important…

Once I finish my book which it’s for the iPad ONLY, and I can see the final book in the Corona Simulator in my Mac…

what I see in my computer will be the same, and it will look and behave exactly the same as in a REAL iPAD?


And one more…

About money – I have to pay $99.00 per year to Apple for the developer program to upload my app to the app store

to see if they accept it, right?

And how much money do I have to pay to Corona for using the program?

Is there any more fees or money involved?


Thank you for everything.

Let’s see how long it takes me to write my book

Victor