Tuesday, 27 May 2008

Open Url

In this Flash tutorial you will learn how to open a URL with a button in Actionscript 2.0. This tutorial only requires one line of code to open a URL. For this tutorial I have used a free stock image of a light bulb for the button which is available at:www.sxc.hu.


Open Url with button

Step 1

Open a new Flash document.
Create your button on the stage. I have used a light bulb for my button, but you can design whatever you wish.
Convert your button into a symbol by selecting F8. Then give your button an appropriate name, check button and click ok.


Step 2

Right click on your button and select “Actions” from the drop down menu, and add the following code:

on (release) {

getURL("http://www.ilike2flash.com");

}

This line of code opens up the above Url in the same window. You can change the Url to whatever you want. If want to open the Url in a new window then add the “_blank” to the end eg.

("http://www.ilike2flash.com","_blank");


Step 3

Test your movie Ctrl + Enter. Try clicking the light bulb and you should see the ilike2flash.com address open up in your web browser.




You should now have a button which opens a url.

UPDATE: new open URL in Actionscript 3.0.

0 comments:

  COPYRIGHT © 2014 · ILIKE2FLASH · Theme by Ourblogtemplates

Back to TOP