If you ever wonder how to create a linked swf in Flash then this easy to follow tutorial will teach you how to create a hyperlink on swf file in Flash in a few simple steps using ActionScript 3.0. Let’s get started.
Step1
Let’s first create a new document (ActionScript 3.0). Now, we have to import a swf file that we want to link so, go to File > Import and select the desired swf file from the location. You can either import your swf file to the Library or directly on to stage.
Step2
I imported my swf file to the Library so I have to drag it on the stage first.
Step 3
Now, on a new layer create a rectangle with the same dimensions as your document. Mine is 450×150 px so, I am creating a rectangle having dimensions 450×150 px.
Step 4
With the rectangle selected, press F8 on your keyboard to bring up the Convert to Symbol dialog. Under Convert to Symbol dialog, choose the symbol type to Button and click OK to close the dialog.
Step 5
Now, we have to tweak some properties of our button object so, go to Properties panel and set its Instance Name to makeitcg (you can use any name that you want) and it’s Color Effect Style to Alpha with value 0
Step 6
Now, Select the first keyframe of the button layer and press F9 to bring up the Actions and write,
var my_url:URLRequest = new URLRequest ("http://makeitcg.com/"); makeitcg.addEventListener(MouseEvent.CLICK, visit); function visit(event:MouseEvent):void { navigateToURL(my_url); }
Replace http://makeitcg.com/ with the url that you want. In line
makeitcg.addEventListener(MouseEvent.CLICK, visit);
I am using makeitcg as it is the instance name of my button object. You have to use the instance name of your object in place of makeitcg.
Step 7
We are done now. Press Ctrl + Enter and click on swf file to test the link.
That’s it. I hope you find this tutorial useful. Good luck.