1

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

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

我现在已经在影片剪辑(在 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 + scrollPane 名称:myMovieClip.myScrollPane.my_btn.addEventListener ...(不起作用)放入场景名称:myScene.my_btn.addEventListener。 ....(不工作)

..以及上述更多不同的组合,没有一个有效..其中一些会产生错误,有些不会..如果 swf 通过,按钮是可见的,但没有做任何事情......

更重要的是,我尝试将新按钮放在其他电影剪辑中,我已经在其中有工作按钮,而新按钮不起作用......我之前放的那个工作得很好.. ??

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

我的按钮代码在它们所在的电影剪辑中。

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

4

1 回答 1

0

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.

于 2011-11-18T18:39:22.767 回答