navigateToUrl AS3 is not opening a web browser

Posted by Ronnie on Stack Overflow See other posts from Stack Overflow or by Ronnie
Published on 2010-03-14T01:22:50Z Indexed on 2010/03/14 1:25 UTC
Read the original article Hit count: 348

Filed under:
|
|

I have a textField on my stage named 'adBuy', which when clicked I want to open up my browser with the defined in URL request. However when I click on the 'adBuy' textField on my SWF it opens Coda, the piece of software I'm using to write this small piece of code?

I am puzzled. Here is my code:

adBuy.defaultTextFormat = adFormat;
adBuy.textColor = 0xFF65CB;
adBuy.x = 640;
adBuy.y = 455;
adBuy.text = "Buy Now";
parent.addChild(adBuy);

adBuy.addEventListener(MouseEvent.CLICK, buyAdvert);

var request:URLRequest = new URLRequest("http://www.google.co.uk");

function buyAdvert(event:MouseEvent):void {

    navigateToURL(request, "_blank");

trace("link clicked");
}

Is there an error in my code, or is this a common problem for which there is an answer?

© Stack Overflow or respective owner

Related posts about navigatetourl

Related posts about as3