A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: Another Scene change question =/ [MX04]

  1. #1
    Member
    Join Date
    Nov 2006
    Posts
    93

    Another Scene change question =/ [MX04]

    Hi,

    I know this sort of question is asked often and I've been searching here about changing scenes, but unfortunately nothing has solved my problem yet.

    My game has three scenes, the menu screen, the actual game and a game-over screen.

    On the menu screen there is a button to start the game, I use the code:

    Code:
     on (release) {
    gotoAndPlay ("GameEasy") ;
    }
    This works fine and the scene "GameEasy" is loaded.

    However I'm trying to do a similar transition between "GameEasy" and "GameOver" to no avail. When the HP bar reaches 0 I want the scene to change to the game-over scene, this will stop me having to try to stop the music playing in the background and unload all of the movie clips flying about the game (which is the problem I get by simply moving to a different frame on that scene which says "Game Over" etc as the arrows keep moving about and the music keeps playing).

    I've tried the same type of code as above (minus the release bit as that code is assigned to a button) inside the HP Bar movie clip on the scene but that doesnt work. I've tried listing the frame label, that doesnt work. I've tried scene name and frame label, nope...Frame label and frame label again, nope. I've tried so many different combinations and I've even tried going back to the Menu scene as I know this scene works correctly and still, nope.

    Anyone have any idea whats going on? A better way to do it? Or anything that might help me?

    Thanks, Mike.

  2. #2
    Senior Member
    Join Date
    Apr 2002
    Posts
    2,849
    From the description of your code, a few things could be going wrong. There's no way to tell exactly without seeing the code you're using. Generally speaking, you can't link directly to a scene from within a movie clip. Using a frame label is the right idea, you just have to make sure you're targeting the right timeline with something like _parent or _root.

    So something like:

    Code:
    on(release){
      _root.gotoAndPlay("frameLabel");
    }

  3. #3
    Member
    Join Date
    Nov 2006
    Posts
    93
    Okay I'm going to forget about the "Game Over" scene. It works fine to go from the menu scene to the game scene and then on the game scene I'll just use a new frame for the game over and have a button to return to the game menu...This works fine.

    I'm stopping the sound fine, but how do I unload the movie clips which are already moving on the screen? If I lose all health and nothing is moving on the scene its fine, but if one has already started it keeps moving on the scene on the game over frame (which obviously looks a bit stupid)...I need a way to make sure every possible movie clip is unloaded.

    Any ideas?

    Thanks so far.

  4. #4
    Member
    Join Date
    Nov 2006
    Posts
    93
    Actually they dont seem to stop at all, they always appear...how can I limit those movie clips to only being loaded/seen in frame 1 of the game scene??

  5. #5
    Member
    Join Date
    Nov 2006
    Posts
    93
    Nevermind, my scene questions are answered...I'll search/ask elsewhere about unloading clips.

  6. #6
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    for unloading a clip.
    first use swapDepths then use removeMovieClip

    clipName.swapDepths(10000);
    clipName.removeMovieClip();

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