It’s been a busy week with lots of interest in Flash. Below are a few links and tutorials that cover some of the most frequently-asked questions we receive about Flash.
How do I turn one of my graphics into a Button?
Select the graphic on the Stage and press F8 or go to Modify > Convert to Symbol. Choose Button from the drop-down and give it a name starting with “btn_”
Select the button again and in the Properties tab give it an instance name as well. This is important for coding later (see below).
Where do I write the action script code?
To bring up the Actions panel go to Window > Actions. Once active you can then drag the panel’s tab into the sidebar to dock it for easy access.
What code do I need to link my button to a specific frame in my timeline?
First, select the button on the stage. While you are learning Flash use the Code Snippets tab in the actions panel to help you. When you select this it brings up a list of categories. Choose Actionscript 3.0 > Timeline Navigation > Click to go to Frame and Stop. The code should look something like this:
Replace the “5” in the last bracket with the frame number you want your button to link to.
My button isn’t working – what’s wrong?
This could be for several reasons. Try the following troubleshooting tips:
Wrong/Missing Instance Name – Check the ‘instance name’ of your button. Because you can re-use the same button several times in a Flash project, you have to give each button an instance.
Select your button on the stage and then go to the properties tab top right – replace the <instance name> with something appropriate. Re-enter your action script code for that button so that it picks up this new information.
Pointing to wrong frame – If you want your button to link to a specific point in your timeline check that the correct frame is written in the brackets in the action script.
When you create button code from the Code Snippets it auto defaults to frame 5 so you may need to change this. e.g. to move to frame 8 and stop would be: gotoAndStop (8)
If you are linking to a label you have created you will need to write the name of the label in speech marks instead of a frame number e.g. gotoAndStop (“off”)
My Movie Clip won’t play!!
MovieClips have wrong/no instance name – If you want the button to link to a movie clip you need to tell Flash which movie clip. Your movie clips should be called something like mc_data1.
Like your buttons you also need to give each movie clip an instance name. Select your movie clip and in the properties create an appropriate instance name.
It is this instance name which we need to use in the Actionscript code not the mc_ title.
e.g. to play frame 8 of a movie clip entitled mc_data1 and with an instance name of data1 the code should look like this:
MovieClip has not been added to the Stage – Your button won’t play a movie clip unless you have actually added it to the stage.
Select the same layer as the button you will use to play the movie clip. Go to your Library and left-click and drag your movie clip to the stage. It will appear as a small circle with a cross-hair in it.
Double-clicking on this small circle takes you inside your movie clip timeline but shows the rest of your stage in the background (very handy for data overlays!)