@5:/\/\@1|\|!!!!1111
________________
In this tutorial,you will learn a bunch of basic stuff like variables and stop(); actions without to much moving around and asking!Let's start.I'll just go down a list and tell you what each action does.
Timeline Control
gotoAndPlay(#); - gotoAndPlay is used in both buttons to go to certain places and used in frames to go to certain frames.Some people are to lazy to click buttons you know :)
EXAMPLE
on(press){
gotoAndPlay(1);
}
This can be used as a simple 'replay' button in Flash.
EXAMPLE 2
gotoAndPlay(1);
Goes to a certain frame without the use of a button.
Where the number '1' is,you can change to whatever to go to whatever frame you want.
During gotoAndPlay,we're led into the _root. function.You may be trying to use a gotoAndPlay() in a movieclip and find that the button/frame won't do anything but change some stuff.This is where _root. comes in(or _parent).The _root function simply uses something like rooting into something or something...I actually don't know,but it's really easy to use.You can use it to change movieclips or the main timeline from in a movieclip.You can use the _root. function in almost every line of script.
EXAMPLE
on(press){
_root.gotoAndPlay(1);
}
Not to hard :)
EXAMPLE 2
_root.gotoAndPlay(1);
Same thing but inside a frame.
gotoAndStop(#); - Everything with this is the same as gotoAndPlay,except for it stops the main timeline/movieclip instead of letting it keep playing.I usually use this in my codes or for maybe a button.
EXAMPLE
_root.gotoAndStop(1);
This will stop the movie on whichever frame chosen.
EXAMPLE 2
on(press){
_root.gotoAndStop(1);
}
This will stop the frame on whichever frame is chosen after pressing a button.
nextFrame(); - This is a really simple thing.It just goes to the next frame.The cool thing about this specific code,however,is that it can be used as a fast-forward button.
EXAMPLE
on(press){
_root.nextFrame();
}
The 'press' function for the button must be used for this to work.
prevFrame(); - Same thing as the nextFrame,except is goes to the previous frame.It can be used as a rewind button.
EXAMPLE
on(press){
_root.prevFrame();
}
play(); - This is for a simple 'play' button.It can also be used in frames in a movieclip or something.
EXAMPLE
on(press){
_root.play();
}
Simply 'play's your movie.
EXAMPLE 2
_root.play();
Starts playing the movie automatically with no buttons.
nextScene(); - This can be used in a button to get to the next scene.I'm not sure if anyone uses it in the timeline though.It could probably be used as a fast-forward through scenes(aka nextScene button).
EXAMPLE
on(press){
_root.nextScene();
}
Simply goes to the next scene.Change 'press' to 'release' if you want to keep people from a fast-forward.
EXAMPLE 2
_root.nextScene();
Goes to the next scene from a frame in the timeline.
prevScene(); - The same as 'nextScene',just backwards.
EXAMPLE
on(press){
_root.prevScene();
}
Used in a button to go to the previous scene.
EXAMPLE 2
_root.prevScene();
Goes to the previous scene from a frame in the main timeline.Could probably be used for a never ending cartoon(endless loop,just like "Triangles vs. Squares".
stop(); - The name says it alls.This code stops the movie during the timeline.It can be used in buttons and on the main timeline very easily.
EXAMPLE
on(press){
_root.stop();
}
Stops the movie on a button press.Used in movie control a lot.
EXAMPLE 2
root.stop();
Stops the timeline without the use of a button.Used on preloader screens,menu screens,and replay screens a lot.
stopAllSounds(); - This stops all the sounds playing(event started sounds).I usually never use this anymore.It's always used to stop music at the end of a movie or something like that.A lot of movies have event looping clips(short loops from Flashkit or something).Then again,a lot of movies stream the music.It doesn't matter,stopAllSounds(); just stops event clips in my mind.
EXAMPLE
on(press){
stopAllSounds();
}
This will stopAllSounds(); on the press of a button.Notice how _root. isn't there?It isn't needed.
EXAMPLE 2
stopAllSounds();
Really simple.Just stops the sounds on a keyframe.
That ends all I have to say about the main timeline.It should be clear enough now,right?
I'll add in variables and stuff next.(in this thread)