HOME | DD
Published: 2010-11-12 00:14:40 +0000 UTC; Views: 1999; Favourites: 30; Downloads: 22
Redirect to original
Description
here's my explanation, key words are in bold and surperflous information is in teletype, sidenotes are in italicsfirst and formost...
I CAN NOT STRESS ENOUGH HOW IMPORTANT IT IS THAT YOU MAKE SURE IT IS USING FLASH ACTION SCRIPT 2.0 (if you already made your movie in another action script like 3.0, don't worry, you can change it in the settings option in the proporties panle)
you have to draw a button like you would drawing any other object (draw it in a new layer on your last frame) you can put it a frame after your animation or on the last frame of your animation depending on weather you want the screen blank while the viewer decides if they want to click that buton and watch it again...
Next select the whole thing and convert it into a button the same way you would convert any art into a symbol. (right click > convert to symbol > select Button from the list of radio buttons)
Double click on your new button
your timeline should now look kind of wierd, there should be 4 boxes now! they each represent a different aspect of your button per frame.
Pres F6 three times
Now go to the hit frame (the frame on the far right of your first set of frames) and draw a rectangle over your button (it doesn't matter what it looks like, you won't see it) unless your button already takes up a solid space (eg you made a circle as your button, the rectangle only applies if your button was a funny shape or text only) the "hit" frame only tells the program where your button is cliclable so that people don't spend forever trying to click on text.
there are 4 frames here for a reason, though none are pivotal to your animation. they are, in order from left to right, Up Over Down Hit in other words they control what your button looks like when the mouse is not touching it (Up), when your mouse is hovering over it (Over), when your mouse is depressing it (Down) and when your mouse has released the button (Hit). Hit is really the only importnat one, but it is asthetically pleaseing to have an animation button that acts similar to a physical button. to 'animate' your button, first click on the first frame (Up) be sure that your button looks the way you want it to before the mouse touches it. next go to your 2nd frame (Over) change your button the way you would edit any other art in flash, I would recomend simply changing the color slightly so that your viewer knows that your button is in fact clickable. Next your 3rd frame (Down) this is the way your button will look while being depressed. I would recomend that you make the button look darker in color and smaller, though any changes are completely up to you. Your hit frame does not matter because it will not be seen anyway, Hit only tells the program what area is clickable.
Now go to scene 1 (you should see a clickable link to scene 1 just below your wierdo timeline). This should make your timeline look normal again,
Now right click on the frame you're on and click on actions (second from the bottom)
be sure your button is not selected then double click "stop". doing this will automatically insert some code into your actions tab, don't worry about this, flash knows what to do)
DON'T CLOSE YOUR ACTIONS TAB instead click on your button. Now you can go back to your actions tab and click on "Global Functions" > "Movie Clip Control" > "on". Doing so will automatically insert some code into the action set for your button. Within the code, Flash will now prompt you for an "on" modifier. Click "release". This will cause your button to do it's action when released after being clicked and not before. You can also set different "on" modifiers such as "press" which will launch the action as soon as the button is clicked.
You will see the following code.
on(release) {
}
Make sure your typing curser is between the squiggl brackets "{}"
now click "Global Functions" > "Timeline Control" > "gotoAndPlay" (double click) this will insert the folowing code
on(release) {
gotoAndPlay();
}
Insert a "1" into the space between the parinthesies "(1)" This will tell Flash that when the button is clicked that the animation should be restarted from frame "1"
now test your animation!
Related content
Comments: 13
DigitalPear [2012-12-27 10:19:01 +0000 UTC]
Sorry... but it says it expects ; before leftbrace. any idea what that means?
👍: 0 ⏩: 1
Stelera In reply to DigitalPear [2012-12-27 12:14:45 +0000 UTC]
First off I would make sure you're using action script 1.0 or 2.0, because the script actually changes a lot between 2.0 and 3.0; it becomes very convoluted and counter-intuitive for someone who hasn't learned C (someone like me!). If that isn't your problem, I would first try inputting a semicolon where it says it expects one; sometimes you just have to give it what it wants. If that doesn't fix it, try erasing the code you have and replacing it with the following:
on (release) {
gotoAndPlay(X);
}
where "X" is the number of the frame you wish to skip to.
👍: 0 ⏩: 1
DigitalPear In reply to Stelera [2012-12-27 16:40:17 +0000 UTC]
Thanks!! It's working now, but it doesn't think the symbol that I converted to a button is a button. Yeesh I'm a flash noob.
👍: 0 ⏩: 1
Stelera In reply to DigitalPear [2012-12-28 07:21:40 +0000 UTC]
You're certain you converted it to a button and not a movie clip or a graphic? I would check that first. Also remember you're going to have to export your animation as an Shockwave File (.SWF) before you can test the button.
👍: 0 ⏩: 1
DigitalPear In reply to Stelera [2012-12-28 07:31:48 +0000 UTC]
I already fixed it! XD I forgot to change the selection to the button after inserting the stop code! but now I have a play button in my new flash project! Thanks!!
👍: 0 ⏩: 1
LuseyMoth [2011-10-04 21:01:12 +0000 UTC]
Oh my god you're a LIFE SAVER.
I've been trying to figure this out all day, thank you so so much
👍: 0 ⏩: 1








