Adding a fast forward button to an Adobe Flash ".fla" file seems potentially tricky the first time you add one. The button requires several lines of code. The first part of the code tells the Flash player to increase the rate of frames being played when the button is pressed. The second part tells the player to skip to the end if there are not enough frames left in the movie to fulfill the first function. You also add code to tell the player to stop the fast forward function when the button is released.
Instructions
Placing the Button
- 1Launch Flash and open an “.fla” file. Add a new layer to the Timeline by clicking the “New Layer” button in the "Timeline" panel. Rename the layer by clicking its name and typing “Button.”
- 2Click the “Window” menu, select “Common Libraries” and click “Buttons.” The buttons library opens in a new panel. Double-click the “Classic Buttons” folder, then “Playback.” Select the “Gel Fast Forward” button and drag it onto the "Scene" window. The "Properties" panel opens.
- 3Type “forward_btn” in the "Instance Name" field of the "Properties" panel.
The onPress Function
- 4Click the “Window” menu and select “Actions.” The following lines of code will make the movie play three times more quickly when the "Fast forward" button is pressed.
- 5Type “forward_btn.onPress=function (){” in the first line and press “Enter.”
- 6Type “_root.createEmptyMovieClip("controller_mc",1);” in the second line and press “Enter.”
- 7Type “controller_mc.onEnterFrame=function(){“ in the third line and press “Enter.”
- 8Type “_root.gotoAndStop(_root._currentframe+3);” in the fourth line and press “Enter.”
- 9Type “if (_root._currentframe+3 > _root._totalframes){” in the fifth line and “_root.gotoAndStop(_root._totalframes);” in the sixth line. This tells the button to go to the end of the movie if the "Fast forward" button is pressed when there are less than three frames left.
- 10Type “}” in lines seven, eight and nine to finish this part of the code.
The onRelease Function
- 11Type “forward_btn.onRelease=function (){” in the 10th line of the "Actions" panel and press “Enter.”
- 12Type “controller_mc.removeMovieClip();” in the 11th line and press “Enter.” Type “}” in the next line to close this portion of the code.
- 13Allow the user to release the "Fast forward" button even if the mouse is not poised over the button by entering three more lines of code. Type ”forward_btn.onReleaseOutside=function (){” in the next line of the "Actions" panel, and then “controller_mc.removeMovieClip();” in the next line, followed by “}” in the last line.
- 14Test the button. Click the “File” menu, select “Preview,” then click “Flash.”
- 1