1

Is there any way to restart an application on a button click using AS3? I want to return the state of the program back to the way it is when it is first ran as I tried calling a method that removes the children from the Sprite layers they are added to but I was getting errors when doing it that way.

I can't remove all children from the Sprite layers as there are certain things on the layers that I want to remove and there are things that I don't want to remove.

Any suggestions?

  • possible duplicate of [How do I restart flash application with actionscript 3](http://stackoverflow.com/questions/14799462/how-do-i-restart-flash-application-with-actionscript-3) – Cilan Feb 17 '14 at 02:29

1 Answers1

1

Generally, you have to create your own cleanup functions. This is obviously very difficult to get working correctly at the end of a project, so I typically work on this in parallel with the actual application. It might look something like:

public function cleanup():void
{
    // Remove listeners.
    // Empty arrays.
    // Remove children.
    // etc
}

There's not really an 'inbuilt' way to do this, so at this stage you've a long process of debugging to go through while trying to cover everything off yourself.

Marty
  • 39,033
  • 19
  • 93
  • 162
  • Yeah that was my biggest issue, having to go backwards and figure out what to remove from where, debugging errors etc. – user3310563 Feb 17 '14 at 00:53