Hi friends,
I’m facing this disgusting problem and I’m sharing with you again for solution. I’m unable to call a child.swf’s function from Parent.swf.
- Make a new Flex project and use child.mxml as the main mxml file.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
public function dummy():void
{
var i:int = 0;
i++;
}
]]>
</mx:Script>
</mx:Application>
- Create a build using Export Release Build option.
- Make another new project and use Parent.mxml as the mail mxml file.
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute">
<mx:Script>
<![CDATA[
private function callChildSwf():void
{
var loader:Loader = new Loader();
loader.load(new URLRequest("child.swf"));
loader.contentLoaderInfo.addEventListener(Event.COMPLETE , callFunc);
}
private function callFunc(e:Event):void
{
(e.target.loader.content as MovieClip).dummy;
}
]]>
</mx:Script>
<mx:Button x="61" y="39" label="Button" id="btn" click="callChildSwf()"/>
</mx:Application>
- Copy child.swf created in step 2 in second project.
- Run the Parent.swf.
You will get a runtime error “ReferenceError: Error #1069: Property dummy not found on _child_mx_managers_SystemManager and there is no default value.”
How do i solve this?