How to Turn an SWF Into a Button With AS3
Adobe Flash helps you to create dynamic presentations for your website. SWF files are the Flash output that you embed in your Web page for display purposes. Perhaps you want to enable the animation to be clickable as well. Use Flash AS3 or ActionScript 3.0 to create a button out of your multimedia presentation.
Instructions
-
-
1
Open your multimedia project in Flash.
-
2
Click "File," then "Publish Settings" and click the Flash tab. Set the language version to "ActionScript 3.0."
-
-
3
Click in the uppermost image layer, and select the "Insert Layer" button located beneath the timeline to create a new layer.
-
4
Choose the "Rectangle" tool on the Tools panel. Drag in the document window to draw a box the size of your presentation. Press "F8" to convert the box to a movie clip.
-
5
Press the "Ctrl" and "F3" keys to open the Properties panel. Set the "Instance Name" field to "swfbtn." Change the "Color" button to "Alpha." Set the alpha value to "0%." This creates a clear button.
-
6
Press "F9" to open the Actions panel and insert the button code:
swfbtn.addEventListener(MouseEvent.CLICK, doButton);
function doButton (e:MouseEvent):void {
var urlTarget:URLRequest = new URLRequest("http://www.bestcompany.com/services.html");
try {
navigateToURL(urlTarget, '_blank');
} catch (e:Error) {
trace("Cannot perform the action");
}
}
Change the link path to the one you want. The movie clip "Instance Name" is used to define the function. Select "Control" and "Test Movie" to test the button.
-
1