利用Flex的MXML中的<s:SWFLoader source ="【路劲】" init=“【当swf可访问属性方法时的时候调用,这里用init(event)】”>
protected function init(event:Event):void
{
event.target.content.addEventListener(FlexEvent.APPLICATION_COMPLETE,applicationCompleteHandler);
}
然后在applicationCompleteHandler中才可以调用加载进来的swf中的方法,才能保证swf完全加载完毕,并且可以访问。
protected function applicationCompleteHandler(event:FlexEvent):void
{
var sysMgr:SystemManager = swfLoad.content as SystemManager;
sysMgr.application["setURL"]("25",1,1,"10")
}
这里通过["方法名"].(相关参数)就可以访问到swf中的相关方法。
如果用as语言添加SWFLoader,则为
swfLoader = new SWFLoader();
swfLoader.addEventListener(Event.INIT,init);
swfLoader.source = "AAACeshi.swf";
addElement(swfLoader) 【需要加这个添加到舞台才会显示出来】
调用swf中的方法用 swf["方法名"](相关参数) 调用相关属性 swf["属性名"]