如何从SWFLoader中的SWF引发事件到父Flex应用程序? [英] How to raise an event from a SWF in a SWFLoader to a parent Flex application?

查看:129
本文介绍了如何从SWFLoader中的SWF引发事件到父Flex应用程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从加载到Flex应用程序的SWF文件(使用SWFLoader)引发事件?

How can I raise an event from a SWF file loaded into a Flex application (using SWFLoader)?

我想要能够检测到

a) when a button is pressed
b) when the animation ends


推荐答案

我采取了一种懒惰的方式来提高flash内的事件

I took a lazier approach for raising the event inside flash

<mx:SWFLoader  source="homeanimations/tired.swf"  id="swfTired" complete="swfTiredLoaded(event)" />

private function swfTiredLoaded(event:Event): void {
     mySWFLoader.content.addEventListener("continueClicked", continueClickedHandler);
}



Flash:



Flash:

dispatchEvent(new Event("continueClicked", true, true));

这篇关于如何从SWFLoader中的SWF引发事件到父Flex应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆