|
|
|
This is our last article on Buttons. Last time we created a button, today we learn to link it to a frame and URL.
Linking button to frame Right-click on the button and choose Actions. These actions are surely new to you. What are Actions? Actions are very similar to JavaScripts that are responsible for performing variety of tasks in a movie. These are the actions that allow Flash to behave as a programming language, e.g. you can use Flash in creating unimaginable interactive games. Excellent repute of the Flash 5 version is due to its vast actions, which are not found in previous versions. An Object Actions window will open. Click Plus sign (+) and choose Go To from the Basic Actions. Click gotoAndPlay(1); and type 5 in the Frame below. After that the actions should look like here below.
on (release) { Lets understand these action scripts. It defines on which mouse event, statement(s) in the braces {} will execute. Its default value is release. You can change it by clicking above script and choosing Event below.
{ It defines statement(s) in the braces that will execute on button release. Here only one statement is used however you can use more than one statement as well. This statement orders the PlayHead to go to frame number 5 and starts playing. Click gotoAndPlay(5); statement and unselect the Go to and Play check box in the bottom. After this the statement will change to gotoAndStop(5);. This statement orders the PlayHead to go to frame number 5 and stops here. Remember semicolon at the end of statement is a mark of completion of one statement. We have set the frame number value to 5 but this frame doesn't exist in our movie. So click frame number 5 and choose Insert > Blank Keyframe. Be sure frame 5 is selected and type 'This is Frame 5' by using Text tool. Click Control > Test Movie, oops! Movie is constantly playing between 1 (button) and 5th (text) frame that doesn't allow the user to press button. It means we have to stop it at frame number 1 (button). So right-click on frame number 1 and choose Actions. Click Plus sign and choose Stop from the Basic Actions. Again test your movie by pressing Ctrl+Enter keys combination. Wa! As you see by using gotoAndStop(5); script, movie stops at frame number 5. What will happen if we use gotoAndPlay(5); script? The movie will immediately come to frame number 1 after displaying frame number 5. Go To Page: 1 2
The copyright of the article FLASH Buttons - Part III in FLASH Programming is owned by . Permission to republish FLASH Buttons - Part III in print or online must be granted by the author in writing.
|
|
|
|
|
|
|
|