如何讓 SWFLoader 與 被載入的程式作溝通
如果使用 SWFLoader 要跟其內部 程式 傳遞參數時,
只要被載入的程式有開放介面提供外部呼叫,
就可以透過 System Manager 來呼叫。
例如:
被載入的程式(SWFLoaded)開放的介面:public function setVarOne(newText:String):void
主程式範例:
MXML :
<mx:swfloader complete="onCompleteAppLoader(event);" id="myLoader" width="300">
ActionScript:
private function onCompleteAppLoader(oEvent:Event):void
{
var smAppLoaded:SystemManager = SystemManager(oEvent.target.content);
smAppLoaded.addEventListener(FlexEvent.APPLICATION_COMPLETE, onCurrentApplicationComplete);
}
private function onCurrentApplicationComplete(oEvent:Event):void
{
_appLoaded = Application(oEvent.target.application);
SWFLoaded(_appLoaded).setVarOne("This value set from main app!");
}
參考連結:http://www.cflex.net/showFileDetails.cfm?ObjectID=690
標籤:
Flex
|
This entry was posted on 下午5:59
and is filed under
Flex
.
You can follow any responses to this entry through
the RSS 2.0 feed.
You can leave a response,
or trackback from your own site.
0 意見:
張貼留言