Groups | Blog | Home
all groups > flash actionscript > september 2006 >

flash actionscript : Moving between Scenes


briencrean
9/30/2006 11:48:57 PM
:confused;

Hi all,

Im relatively new to Flash. Im having a bit of trouble at the minute creating
a simple flash game. Its a very basic space shooter. When the user dies two
buttons appear alowing the user either to restart the level or return to the
main menu.

Here is the script for the return to main menu button:
on ( release )
{gotoAndPlay("Scene 1", 1);}

I also have a stop(); on the 1st frame of Scene 1

However when I click the [i]main menu[/i] button it flashes to the main menu
and then back to the frame that the 2 buttons are on.

I have tried for so long to fix this but with no success.

The game so far is here:
http://193.1.99.6/%7Ecreanb/FlashWorkshop.html

Can anyone help? Thanks in advance

Brien
kglad
10/1/2006 12:01:47 AM
don't use scene information for navigation and don't use the goto functions.
label your frames and use the goto methods:



on ( release )
{_root.gotoAndPlay("Scene1_frame1");} // and label this frame Scene1_frame1
briencrean
10/1/2006 8:17:21 PM
Thanks for your reply kglad.

I took out the scene navigation so the game is now all in scene 1 and I used
the method you suggested to move the playhead from the 'game over' frame back
to the main 'menu' frame, but I still have the same problem.

The other button has no problem returning to the beginning of the level, so I
do not understand why the other button will not move back to a frame further
back in the timeline.
kglad
10/1/2006 10:01:29 PM
you didn't need to remove your scenes. you just needed to change from goto
functions and using two parameters (including scene info) to using the goto
methods and using frame labels.

show the code you're using and the frame label that's in your properties panel
attached to the frame to which you want to navigate.
briencrean
10/1/2006 11:33:12 PM
I have attached the code that I am using

Here is the updated link of the game:
http://193.1.99.6/%7Ecreanb/FlashWorkshop.html

If you start the game and die by colliding with the enemy mc's the two buttons
will appear. If you click on the main menu button you can see the main menu
flashing and the playhead returns immediately to the game over screen where the
two buttons are located.

Thanks again


//this code is attached to the main menu button which appears when the player
dies
on ( release )
{
_root.gotoAndPlay("menu");
// "menu" is the label for frame 43 in Scene 1
}
kglad
10/1/2006 11:40:00 PM
briencrean
10/1/2006 11:53:42 PM
:smile;

Thanks kglad. It just clicked with me from your last reply that I wasn't
resetting the health value back to full when the game over screen was
displayed, leaving the condition for the playhead to go to the 'game over'
screen always true!

Thanks

Brien
kglad
10/3/2006 12:00:00 AM
AddThis Social Bookmark Button