Forum for Digital Media Arts (DMA) Students & Alumni
Home­Register­Gallery­FAQ­Search­Memberlist­Usergroups­Log in
Post new topic   Reply to topicShare | 
 

 Opening an External Html page with Actionscript 3.

View previous topic View next topic Go down 
AuthorMessage
jorgelopez



Posts: 26
Join date: 2009-01-18
Age: 23

PostSubject: Opening an External Html page with Actionscript 3.   Sat Jun 20, 2009 2:42 pm

In some situations it is required to link to an external website. If your website is created mainly in Flash then linking to an external website is like this.

1. create a button or a movieclip to act as a button.
2. Give your buttton an instance name.
3. Write the actionscript code for it. It is like this.

Lets say your button is named "myButton".
Set up the listener for the onclick event.

Code:
var url:URLRequest = new URLRequest("http://google.com");

myButton.addEventListener(MouseEvent.CLICK, myButtonClick);

function myButtonClick(event:MouseEvent):void
{
   navigateToURL(url);
}


Check out a working example below!

Back to top Go down
View user profile
 

Opening an External Html page with Actionscript 3.

View previous topic View next topic Back to top 
Page 1 of 1

Permissions of this forum:You cannot reply to topics in this forum
Digital Media Arts (DMA) :: Software :: Adobe Flash-
Post new topic   Reply to topic