navigatorToUrl AS3 未打开 Web 浏览器

发布于 2024-08-25 10:02:00 字数 571 浏览 3 评论 0原文

我的舞台上有一个名为“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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

盛夏尉蓝 2024-09-01 10:02:00

抱歉,我已经解决了我的问题。

看来它没有使用 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文