How to Create a URL Call in Flash CS5
Writing code to add function within Adobe Flash CS5 differs from past versions of the program. The program now uses Actionscript 3, which is much different than the Actionscript 2 of the past. A URL call allows you to direct users to other websites from within a Flash website or movie. You will have to add code to your Flash project in order to enable your URL call.
Instructions
-
-
1
Select "Insert" from the main menu, and select "New Symbol" to create a symbol. Give your symbol a name and select "Button" from the "Type" drop down menu. Select the oval tool from your tool menu and draw a circle while in symbol editing mode.
-
2
Select the "Over" state for your new button in the timeline at the bottom of the page. Hit the "F6" to copy your artwork into the keyframe. Repeat the process for the "Down" and "Hit" state. Exit symbol editing mode by selecting "Scene 1" above the stage.
-
-
3
Create a layer called "Actions" and "Button" at the bottom of the stage. Select the first keyframe of your "Button" layer and drag your button onto the stage. Make sure your button is selected and give it an instance name of "Mybutton" under the "Properties" tab.
-
4
Right click the first keyframe of the "Actions" layer and select "Actions" from the menu that appears. Type "stop();" on the first line to stop your movie from going past the first frame.
-
5
Add "Mybutton.addEventListener(MouseEvent.CLICK, Gomyurl);" to the next line to tell flash to listen to an event related to your button you placed on the stage.
-
6
Type "function Gomyurl(event:MouseEvent):void {'' on the next line to begin to define the function of your button. Add "navigateToURL(new URLRequest("http://www.mywebsite.com/"));" to the next line. Replace the website in parenthesis with the one you would like to call.
-
7
Type "}'' on the bottom line of your code, and then exit out of the dialogue box.
-
8
Test your URL call by selecting "Control" from the main menu. Select "Test Movie" and "In Flash Professional". Click your button to make sure it goes to the correct URL.
-
1
References
Resources
- Photo Credit Photos.com/Photos.com/Getty Images