开发者

navigateToUrl AS3 is not opening a web browser

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 buyAd开发者_JS百科vert(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?


Sorry, I have solved my problem.

It appears the reason it was not opening a web browser with the URL it because I was running the SWF through 'Test Movie' in Flash. This appears to have been stopping the code working.

It did however work fine when I ran it in Flash Player.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜