Flash 双击外部加载的 SWF
我有一个类(它扩展了 MovieClip),可以加载外部 SWF(用 pdf2swf 制作)。它被添加到另一个已声明 doubleClickEnabled = true
的类中,并且我正在侦听 DOUBLE_CLICK 事件。
问题是当加载 SWF 时,我的代码没有拾取 DOUBLE_CLICK 事件,仅拾取 CLICK 事件。我已经尝试过,但没有将 SWF 添加到舞台,它确实会拾取 DOUBLE_CLICK 事件。
有人以前遇到过这个吗?
class ParentClass{
...
public function ParentClass(){
...
mcToLoadSWF = new MovieClip();
addChild(mcToLoadSWF);
doubleClickEnabled = true;
addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
...
}
}
我还尝试将事件侦听器添加到 mcToLoadSWF 中。没有骰子。
I've got a class (which extends MovieClip) that loads in an external SWF (made in pdf2swf). That is added to another class which has declared doubleClickEnabled = true
and I'm listening for DOUBLE_CLICK events.
The problem is when the SWF is loaded my code picks up no DOUBLE_CLICK events, only CLICK events. I've tried it without adding the SWF to the stage and it does pick up DOUBLE_CLICK events.
Anybody come across this before?
class ParentClass{
...
public function ParentClass(){
...
mcToLoadSWF = new MovieClip();
addChild(mcToLoadSWF);
doubleClickEnabled = true;
addEventListener(MouseEvent.DOUBLE_CLICK, doubleClickHandler);
...
}
}
I've also tried adding the event listener to the mcToLoadSWF as well. No dice.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这里发生的情况是,您双击的是加载的剪辑,它不是 doubleClickEnabled,因此不会生成该事件,也不会像其他鼠标事件一样冒泡到您的剪辑。将 mouseChildren 设置为 false 以不将鼠标事件发送到加载器的子级,但这当然意味着它们中的任何交互都将不起作用。
What's happening here is that what you are double-clicking is the loaded clip, which is not doubleClickEnabled and therefore the event is not generated, and is not bubbled up to your clip like the other mouse events. Set mouseChildren to false to not send mouse events to the children of your loader, but of course this means that any interactivity in them will not work.