浏览 2803 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2009-11-06
this.initializeComponent(); swfReady; this.dispatchEventToJavaScript(swfReady); protected function dispatchEventToJavaScript(param1:Object) : void { var event:* = param1; try { if (ExternalInterface.available) { ExternalInterface.call(this.javaScriptEventHandler, this.elementID, event); } } catch (error:Error) { if (error is SecurityError) { this.showFatalError("Warning: Cannot establish communication between YUI Charts and JavaScript. YUI Charts must be served from HTTP and cannot be viewed locally with file:/// protocol unless location is trusted by Flash Player.\n\nFor more information see:\nhttp://www.adobe.com/products/flashplayer/articles/localcontent/\n\n"); } } return; }// end function 问题找到了,现在在自己的flex加个代码 protected function applicationComplete() : void { this.elementID = this.loaderInfo.parameters.elementID; //从参数中得到JS提供给Actionscript的事件回调函数 this.javaScriptEventHandler = this.loaderInfo.parameters.eventHandler; if (ExternalInterface.available) { this.dispatchEventToJavaScript({type:"swfReady"}); } else { throw new IOError("Flash YUIComponent cannot communicate with JavaScript content."); } }// end function 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |