A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] [F8] forced restart of file?

  1. #1
    Junior Member
    Join Date
    Apr 2007
    Posts
    4

    [RESOLVED] [F8] forced restart of file?

    Hi,
    With the game that I'm working on, it starts on the main menu and then continues onto a different scene with the actual game contents. An on load event initializes the location of everything once this scene is loaded. Now, I didn't quite realize that when I switched scenes, all objects and variables would remain. What I want is to be able to switch back to the first scene, then the game scene and have everything initialized again.

    So I'm trying to find out... is there a way to essentially restart the file without manually doing so? That is, control will shift to the first scene and it will be as if the file was just opened. I sort of doubt the existence of this sort of function and obviously haven't found it yet, although I've searched.

    Hopefully that's clear enough. Thanks.

  2. #2
    Senior Member PRadvan's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    261
    Here's what you can try;

    Start all your script, content, etc, on frame 2. Leave frame 1 empty.
    Define all the variables you are using at the begining of the script (in frame 2).
    You don't have to set a value (as you might not know what you want it to be yet) but defining a variable clears it.

    When you reach the end and want to restart, start from frame 1.

    Hope this works.

    ps - as far as I know, there is not "forced restart" function

  3. #3
    Junior Member
    Join Date
    Apr 2007
    Posts
    4
    Thanks, that seems to work for the most part. A couple of things still are not resetting properly but hopefully I can fix that.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center