As: Play And Stop Buttons 2005-07-19 10:07:44
NOTICE: DO NOT PLACE ANY BUTTONS INSIDE A MOVIECLIP!!!
Hello, since the question has been brought up, I think it's time to make a tutorial that will cover basic frame manipulation, I am addressing and will cover
-Playing and Stopping a flash movie using stop() and play()
IF you're using scenes gotoAndStop and gotoAndPlay will give you trouble
First of all I'd like you to all have buttons ready, do this simple, draw something you would like as a button, and click F8 while it is selected to convert it into a button , if you wish to not go through this process click window->common libraries->buttons and drag one of those buttons into the screen
The envilope AS
All our scripts will be insite an "envilope" script, which means "trigger when the button is pressed", this tutorial will not cover that, AS: Replay button touches those, but I will just supply the envilope code, put this in the buttons actions (you can spawn that in window->development panels->actions)
put this code in the actions, make sure it says "Actions - Button", if it does not click the button, it should change:
this is an event handler for "releasing the mouse over the button", it is what we'll ususally use.
we will use 2 types of actions, actions on our button and actions on the frame itself... frame actions do NOT go into our "envilope"
The very basics
place your button on some random frame in your movie, add the action play(); to it, this tells flash to play, it should now look like this:
now since we want the actual movie to pause, we go to that frame's actions and we alter them to
now when the movie achieves the frame with the button it should pause, when the button is clicked it will play again...
you can also do the reverse, have a "stop" button with the actions
and another play button near it, this will pause the movie... pretty easy huh?
I guess it really is!
ask any questions here