Skip to main content
Participant
May 2, 2008
Question

Making Buttons Which Link To A Url (AS3)

  • May 2, 2008
  • 2 replies
  • 414 views
Im trying to make an enter page to my website
The only problem is making the enter button
go into the homepage
iv'e searched all around for a simple solution
but i cant find one
help please ?
This topic has been closed for replies.

2 replies

Ned Murphy
Legend
May 2, 2008
I am somewhat at a disadvantage because my AS3 PC is out of commission so I can't refer to the help file... but... I believe the second argument in the navigateToURL() function call is not the URL (the request var takes care of that), but is the window reference for the new page.

If you want it to open a new window you would code:

navigateToURL(request,"_blank");

or to take over the current window you would put:

navigateToURL(request,"_self");

(I'm guessing on the second based on HTML experience)

If that doesn't solve your problem, then include the error message(s) you get in your reply.

Also, I don't know if precedence is really an issue, but the more common way to code listeners is to have them after the function is defined:

function onMouseClick(e:MouseEvent):void
{
var request:URLRequest = new URLRequest("http;//www.kkds.co.uk");
navigateToURL(request,"_self");
}

myButton.addEventListener(MouseEvent.CLICK,onMouseClick);




Ned Murphy
Legend
May 2, 2008
Are you familiar with using event listeners and functions for buttons as far as AS3 goes?

If so, then you need to use the navigateToURL() function in the button function to switch to another web page.
KKDSAuthor
Participant
May 2, 2008
This is the code ive written but it doesnt work ?
There an error