mySWFLoader.content.myProperty = myValue;

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of ivansebastiansurya
Sent: Thursday, May 17, 2007 5:55 PM
To: [email protected]
Subject: [flexcoders] Re: Communication of data between parent and child
movie.

 

--- In [email protected] <mailto:flexcoders%40yahoogroups.com>
, "Tracy Spratt" <[EMAIL PROTECTED]> wrote:
>
> And if loose coupling is not a key issue for you, you can simply 
access
> public members in the loaded swf using the "content" property of
> SWFLoader. If you are loading appliations, use SWFLoader, not 
Image.
> 
> 
> 
> Access top level application members using Application.application.
> 
> 
> 
> You will need to listen for the complete event of the loader and the
> APPLICATION_COMPLETE event of the loaded app before you can access
> properties via the "content" property:
> 
> <mx:SWFLoader id="ldMain" progress="showProgress(event)"
> width="100%" height="100%" 
> 
> complete="onCompleteAppLoader(event)"/>
> 
> 
> 
> /** runs when SWFLoader content has all downloaded */
> 
> private function onCompleteAppLoader(oEvent:Event):void
> 
> {
> 
> var smAppLoaded:SystemManager =
> SystemManager(oEvent.target.content);
> 
> smAppLoaded.addEventListener(FlexEvent.APPLICATION_COMPLETE,
> onCurrentApplicationComplete)
> 
> //vbMask.visible = false;
> 
> }//onCompleteAppLoader
> 
> 
> 
> /** runs when the app loaded in the SWFLoader has completed
> initialization
> 
> * and is ready for any access (applicationComplete event)
> 
> */
> 
> private function onCurrentApplicationComplete(oEvent:Event):void
> 
> {
> 
> _appLoaded = Application(oEvent.target.application);
> 
> _sAppLoadedUrl = _appLoaded.url
> 
> var iPosLastPathDelimiter:int = _sAppLoadedUrl.lastIndexOf
("\\");
> 
> if (iPosLastPathDelimiter == -1) {
> 
> iPosLastPathDelimiter = _sAppLoadedUrl.lastIndexOf("/");
> 
> }
> 
> _sAppLoadedName =
> _sAppLoadedUrl.substring
(iPosLastPathDelimiter+1,_sAppLoadedUrl.lastInde
> xOf("."));
> 
> }//onCurrentApplicationComplete
> 
> 
> 
> /** */
> 
> public function showProgress(oEvent:Event):void
> 
> {
> 
> var sBytesLoaded:String = oEvent.target.bytesLoaded;
> 
> var sBytesTotal:String = oEvent.target.bytesTotal;
> 
> _nLoadProgress = (sBytesLoaded/sBytesTotal) * 100;
> 
> lbLoading.alpha = 1/_nLoadProgress * 10;
> 
> if (_nLoadProgress == 100) {
> 
> lbLoading.visible = false;
> 
> lbLoading.alpha = 1; 
> 
> }
> 
> 
> 
> } //showProgress
> 
> 
> 
> Tracy
> 
Hi Tracy,

Thanks for your reply. However, I have one question. How if I want 
to actually get a public property of my child application?
Say my child application has a public property called parentProp.
How can I assign values to parentProp (String type) from the parent 
application? I.e. I need to pass info from parent to child?
Thanks.

Ivan.

 

Reply via email to