This basic tutorial covers on handlers, gotoAndStop, and is for the use of creating a replay button, I will use the most basic stuff I can in order to help practically rather then teach, this is mainly for practical people rather then people who want the actual learning.
I will not cover buttons themselves.
What to do?
Click the "Window" tab, and inside it click "Other Panels" and click "Buttons", a small panel will pop, now go to the last frame of your last scene, click the folders and find a button you would like, I recommand clicking "Circle Button". click the button you would like to use and drag it to the stage for the last frame of the last scene.
Now you have a button on your scene, you need ot make it do stuff ;)
Click the actions panel to open it, if it's not open click "Window"->"Development Panels"->"Actions"
click the button and make sure the Actions panel is now titled "button actions", you can write in it, now let's see what the code is.
first of all we need to tell the button WHEN to trigger, we can make it trigger when the mouse is over it, when it is released on it, when it is pressed on it, when a certein key is down, and many more, this is done by the "on" button handler
on(release) triggers when the mouse is released over the button
on(press) triggers when the mouse is pressed over the button
these are the main two we will use since they are the most common.
after a handler in flash we always use '{' brackets to specify the start and end location of the code that handler triggers, so generally
on(release){
<Code Here>
}
is the syntax we will use.
let's now look into the current frame manipulation flash provides us with, there are several
remarks are in //
stop(); //this action causes the movie to stop
play(); //this action causes the movie to play
nextFrame(); //this action cuases the movie to go to the next frame as stop
prevFrame();//same as nextFrame, only it goes to the previous frame
nextScene();//goes to the next scene and stops
prevScene();//goes to the prev scene and stops
gotoAndStop(<frameNumber>); //goes to a certein frame number (or label) and stops
gotoAndPlay(<frameNumber>); //goes to a certein frame number (or label), and plays
gotoAndStop(<scene>,<frameNumber>);//goes to a certein frame in a certein scene and //stops
gotoAndPlay(<scene>,<frameNumber>);//goes to a certein frame in a certein scene and //plays
the most powerful method is the one we will used, gotoAndPlay(<scene>,<frameNumber);
by placing this action, once triggered (when the on statement occurs) the flash movie will go to the given frame in the given scene
I will presume you want to go to the second frame in your first scene for replay
our actions were
on(release){
}
and we will now add the gotoAndPlay part
on(release){
gotoAndPlay("Scene 1",2);
}
the frame number can be a number between 1 and the total frames in the scene, the scene name must be accurate, it is case sensative, if you don't use scenes, drop it and use gotoAndPlay(<frameNumber); instead.
to find out the accurate scene name click "Window"->"Design Panels"->"Scene". use the scene name (case sensative) exactly as shown there.
for those of you who use movieclips, don't pkace this code anywhere in a movieclip for path reasons, the button must be on the base timeline
hope this helps.
ask any questions.
Inglor
p.s.
sorry for having to use the APS account again.