Accessing Modules from Parent Application

Definition:

Communication between modules, parent applications &

among modules.It will access the methods and properties

of module from the parent application to the module.

ChildProperty is an instance of the module’s class.

SourceCode: Parent Module:

<?xml version=”1.0″ ?>

<mx:Application xmlns:mx=”http://www.adobe.com/2006/mxml“>

<mx:Script>

<![CDATA[

[Bindable]

private var s:String;

private function getTitle():void {

s = (m1.child as child_module).getModTitle();

}

]]>

</mx:Script>

<mx:Label id=”l1“ text=”{s}“ />

<mx:ModuleLoader url=”child_module.swf“ id=”m1“ ready=”getTitle()“ />

</mx:Application>

Child Module:

<?xml version=”1.0″?>

<mx:Module xmlns:mx=”http://www.adobe.com/2006/mxml”

width=”100%” height=”100%”>

<mx:Script><![CDATA[

public function getModTitle():String {

return "Accessing Modules from Parent Application";

}

]]>

</mx:Script>

</mx:Module>


With Regards

Hemakumar.S

Respond to this post