Jump to content

URL Request in Actionscript 3.0


Guest lapointe2041

Recommended Posts

Guest lapointe2041

First, I would like to say that hate actionscript 3.0!!!

 

I need to make a URLrequest with a Mouse Event and I can not for the life of me figure it out!!

 

Here is my current code:

 

web_btn.addEventListener(MouseEvent.CLICK,webClick);

function webClick (e:MouseEvent) {

new URLRequest("http://www.google.com");

}

 

 

What needs to be fixed?

 

 

THANKS!!!

Link to comment
Share on other sites

Guest flamedude

web_btn.addEventListener(MouseEvent.CLICK,webClick);

function webClick (e:MouseEvent) {

var link:String = "http://www.google.com";

var request:URLRequest = new URLRequest(link);

navigateToURL(request);

}

 

That should do it for you. I know it looks more complicated than the getURL method though. If you want the getURL back again go to Senoculars website and you can download some classes that get some of the old easier AS2 coding methods back into your AS3 projects.

 

Don't give up on the AS3 though, it does seem extremely daunting during your first few experiences with it but it is totally worth learning it. I kept delaying it for a long time but I finally got pushed to use it and it really has grown on me. Some things now take 3 times as much code to do (like the URLRequest) and other things are now 3 times quicker like XML integration so its sort of 2 steps backwards 3 steps forwards. Event handling may seem like a new and bizarre way of doing things but it really is a godsend in covering every possible situation and if you are smart you can use the same functions to handle almost every button and interaction in your flash.

 

Never give up! Trust your instincts! - peppy hare

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...