Jump to content

  • Log In with Google      Sign In   
  • Create Account


IronyGames

Member Since 30 Mar 2012
Offline Last Active Dec 11 2013 07:00 AM

#4970636 Game scenes transition in AS3

Posted by IronyGames on 17 August 2012 - 12:49 PM

Quickest way is to addChild() when you want to add the scene to the stage (remember to set the coords!), and removeChild() when you want it gone.

Scenes, therefore, should extend Sprite or MovieClip or so; basically having a huge MC-container for all the stuff in the different scenes. Or what you have is just fine, remember to export for AS3.

Couple tips:
  • First add the new scene so it's atop of the stage, then remove the old scene. Doing viceversa will make an ugly effect where there's nothing for a second.
  • The MCs might take time to be added, you might want to control that.
  • Make sure to make the MC instances point null when you're done with them so the garbage collector can free memory!

Another choice is to add all the childs and to have their alpha = 0 unless they are needed. This is quicker for time, but more memory-expensive I think, and besides they have to have a stop button when they're not opaque -- meaning it's not their turn.


I was unaware of your AS3 level so I tried to explain as much as possible.


PARTNERS