影片剪辑中的 AS3 按钮,位于 ScrollPane 中

发布于 2024-12-17 07:56:30 字数 963 浏览 0 评论 0原文

我有多个场景 *.fla,场景之间使用按钮进行链接,效果很好。

其中一些场景包含组件 ScrollPane(每个场景 1 个),在 ScrollPanes 内有包含按钮的影片剪辑区域 - 这些按钮也可以很好地链接到其他场景。

我现在已在影片剪辑(ScrollPane 内)“转到网络”中放置了新按钮...这不起作用...编译为 swf 时不会报告任何错误,按钮在那里但不执行任何操作。

我使用代码片段中的简单代码:

my_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void{
navigateToURL(new URLRequest("http://www.site.com/"), "_blank");
}

我搜索了解决方案并尝试了以下操作:

将影片剪辑名称放在按钮前面: myMovieClip.my_btn.addEventListener ...(不工作) 输入 mc + 滚动窗格名称: myMovieClip.myScrollPane.my_btn.addEventListener ...(不工作) 放置场景名称: myScene.my_btn.addEventListener .....(不起作用)

..以及上面的更多不同组合,没有一个起作用..其中一些会产生错误,有些则不会..如果swf通过,按钮可见但不执行任何操作...

什么是更多我尝试将新按钮放入其他影片剪辑中,其中我已经有工作按钮,但新按钮不起作用......我之前放置的按钮工作得很好......?

不知道怎么想?我是否已超出按钮限制?1 个 *.fla 中可以拥有的按钮数量是否有限制? (我认为大约有 130 个,在大约 60 个场景中,每个场景只有一帧和两层 - 一层用于内容,一层用于动作)

我的按钮代码位于影片剪辑中它们所在的位置。

如果有人可以提供线索吗?

I have a multiple scenes *.fla, there is a linkage between scenes using buttons which works just fine.

Some of these scenes contain components ScrollPane (1 per scene), inside a ScrollPanes there area movie clips holding buttons - which also work fine linking to other scenes.

I have now put new button within movie clip (within ScrollPane) "go to web" ... which doesn't work... no errors are reported when compiling to swf, button is there but doesn't do anything.

I was using simple code from code snippet:

my_btn.addEventListener(MouseEvent.CLICK, onClick);
function onClick(e:MouseEvent):void{
navigateToURL(new URLRequest("http://www.site.com/"), "_blank");
}

I searched for solutions and tried following:

put movieclip name in front of button:
myMovieClip.my_btn.addEventListener
... (not working)
put mc + scrollPane name:
myMovieClip.myScrollPane.my_btn.addEventListener
... (not working)
put Scene name:
myScene.my_btn.addEventListener
..... (not working)

.. and more diferent combinatios of above, none works.. some of them produce errors, some not.. if swf goes through, button is visible but doesn't do anything...

What's more I tried to put new buttons within other movie clips that I already have working buttons in them, and the new buttons not working.....the one I put earlier working just fine.. ??

I don't know what to think? Have I run out of button limits, is there a limit of how many buttons you can have in 1 *.fla? (I have about 130 I would think, on about 60 scenes, each scene has just one frame, and two layers - one for content one for actions)

my code for buttons is in movie clip where they are.

If any one could give a clue please?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

花海 2024-12-24 07:56:30

在我看来你的代码没问题。问题可能出在 Flash 的安全沙箱措施内部。

如果您在自己的计算机上测试应用程序,则需要启用对 swf 正在播放的文件夹的访问,或将其编译为仅访问网络(默认情况下,swf 编译为仅访问本地文件)。更多信息请参见:http://www.adobe.com/devnet/flash/articles /local_network_playback.html

如果您在网络服务器中测试它,则必须在 crossdomain.xml 上添加一个条目,以允许访问以下站点。

Looks to me that your code is fine. The problem is probably inside Flash's security sandbox measures.

If you're testing your application on your own computer, you'll need to enable access to the folder the swf is playing at, or compile it to access network only (by default swfs are compiled to access local files only). More info here: http://www.adobe.com/devnet/flash/articles/local_network_playback.html

If you're testing it in a webserver, you're gonna have to add a entry on the crossdomain.xml allowing access to the following site.

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