navigatorToUrl AS3 未打开 Web 浏览器
我的舞台上有一个名为“adBuy”的文本字段,单击该文本字段时我想使用 URL 请求中定义的内容打开浏览器。但是,当我单击 SWF 上的“adBuy”文本字段时,它会打开 Coda,我用来编写这一小段代码的软件?
我很困惑。这是我的代码:
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");
}
我的代码中是否有错误,或者这是一个有答案的常见问题吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
抱歉,我已经解决了我的问题。
看来它没有使用 URL 打开 Web 浏览器的原因是因为我通过 Flash 中的“测试电影”运行 SWF。这似乎已经停止了代码的工作。
然而,当我在 Flash Player 中运行它时,它确实工作得很好。
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.