It has to do with the timing of everything.

The last example code of your SWF was:
var t:String;  // which sets to undefined
myText.text = t;

So when the SWF's first frame plays it sets myText.text to "undefined".

It seems that your SWF goes on past the first frame ( or stops
execution ) before the Loader.content gets to set the variable "t".  

So the execution sequence would look something like this:
Loader calls SWF.
SWF calls first frame action script and sets myText.text = t (which is
undefined)
SWF moves on to or stops executing first frame actionscript.
Loader.content.t is set.
Now myText.text = t is never called again and the new value is not set.

In the case where you call myText.text directly you are not setting a
variable that has a execution based on some timeline but directly to
the correct value you want to change.

An alternate is do:
progress="event.target.content.t ='Hello
World';event.target.content.gotoAndPlay(1)"

But the setting of variables directly is much better.

Talking to loaded SWF's are not exactly like FlashVars because it
depends on the nature of the SWF where things are initialized/set.

I hope that makes sense,

Renaun  

--- In flexcoders@yahoogroups.com, "Philippe Maegerman" <[EMAIL PROTECTED]> 
wrote:
> I tried it and noticed it worked, but couldn't guess why assigning a
value to a variable wouldn't work.
> That was the original problem where variables were passed through
Flashvars and used later in a XML download.
> It was just puzzling me ;))
>  
> Philippe Maegerman
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
On Behalf Of kaibabsowats
> Sent: mercredi 31 août 2005 15:59
> To: flexcoders@yahoogroups.com
> Subject: [flexcoders] Re: Embedding a slideshow swf that calls image
files
> 
> 
> Try progress="event.target.content.my_txt.text ='Hello World'"
> 
> The example code off my blog uses a dynamic textfield variable but
> this should work also.  
> 
> Make sure the parent SWF (flex) and the loaded SWF are in the same
> domain or you will get cross-domain security issues.
> 
> Renaun
> 
> --- In flexcoders@yahoogroups.com, "Philippe Maegerman" <[EMAIL PROTECTED]>
wrote:
> > I thought you found the trick by using 'progress' instead of 'load'
> or 'creationComplete' but that doesn't work for me.
> >  
> > I have a flex file that is loading swfVar.swf and assigns a value to
> the property 't' like this:
> >  
> > <?xml version="1.0" encoding="utf-8"?>
> > <mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml";>
> > <mx:Loader contentPath="swfVar.swf" progress="event.target.content.t
> ='Hello World'">
> > </mx:Loader>
> > </mx:Application>
> >  
> > The swf contains one TextField called 'my_txt', its text is
> populated with a variable 't' that should have been assigned a value
> by the mxml file as you suggest:
> >  
> > swfVar.swf
> > -------------
> > var t:String;
> > my_txt.text = t;
> >  
> > But the textfield always shows 'undefined'
> >  
> > Maybe I didn't understand what you were blogging about, do not
> hesitate to correct me.
> >  
> > Cheers,
> >  
> > Philippe Maegerman
> > 
> >  
> > ________________________________
> > 
> > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED]
> On Behalf Of kaibabsowats
> > Sent: mardi 30 août 2005 20:15
> > To: flexcoders@yahoogroups.com
> > Subject: [flexcoders] Re: Embedding a slideshow swf that calls image
> files
> > 
> > 
> > I blogged some more info on the SWF FlashVar, view it at:
> > 
> > http://renaun.com/blog/?p=4
> > 
> > 
> > 
> > 
> > --
> > Flexcoders Mailing List
> > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> > Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> > 
> > 
> > 
> > 
> > SPONSORED LINKS 
> > Web site design development
>
<http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=FkTWphZzV9mFulU7V3u7pQ>
>       Software design and development
>
<http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=w0jnvy4gyxC04c4dhRnw6A>
>       Macromedia flex
>
<http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=XXu7YeegB3Vi-5Qngf6oNQ>
>       
> > Software development best practice
>
<http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=ZT_U6e_iPgXSriY_dI9nIg>
>       
> > 
> > ________________________________
> > 
> > YAHOO! GROUPS LINKS 
> > 
> > 
> >       
> > *      Visit your group "flexcoders
> <http://groups.yahoo.com/group/flexcoders> " on the web.
> >         
> > *      To unsubscribe from this group, send an email to:
> >       [EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]> 
> >         
> > *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/> . 
> > 
> > 
> > ________________________________
> > 
> > 
> > 
> > ------------------------------------------------------------------
> > **STATEMENT OF CONFIDENTIALITY** 
> > 
> > This e-mail and any attached files are confidential and intended
> solely for the use of the individual to whom it is addressed. If you
> have received this email in error please send it back to the person
> that sent it to you. Any views or opinions presented are solely those
> of author and do not necessarily represent those the Emakina Company.
> Unauthorized publication, use, dissemination, forwarding, printing or
> copying of this email and its associated attachments is strictly
> prohibited.
> > 
> > We also inform you that we have checked that this message does not
> contain any virus but we decline any responsability in case of any
> damage caused by an a non detected virus.
> > ------------------------------------------------------------------
> 
> 
> 
> 
> 
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Search Archives:
http://www.mail-archive.com/flexcoders%40yahoogroups.com 
> 
> 
> 
> 
> SPONSORED LINKS 
> Web site design development
<http://groups.yahoo.com/gads?t=ms&k=Web+site+design+development&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=FkTWphZzV9mFulU7V3u7pQ>
        Software design and development
<http://groups.yahoo.com/gads?t=ms&k=Software+design+and+development&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=w0jnvy4gyxC04c4dhRnw6A>
        Macromedia flex
<http://groups.yahoo.com/gads?t=ms&k=Macromedia+flex&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=XXu7YeegB3Vi-5Qngf6oNQ>
        
> Software development best practice
<http://groups.yahoo.com/gads?t=ms&k=Software+development+best+practice&w1=Web+site+design+development&w2=Software+design+and+development&w3=Macromedia+flex&w4=Software+development+best+practice&c=4&s=131&.sig=ZT_U6e_iPgXSriY_dI9nIg>
        
> 
> ________________________________
> 
> YAHOO! GROUPS LINKS 
> 
> 
>       
> *      Visit your group "flexcoders
<http://groups.yahoo.com/group/flexcoders> " on the web.
>         
> *      To unsubscribe from this group, send an email to:
>        [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]> 
>         
> *      Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service <http://docs.yahoo.com/info/terms/> . 
> 
> 
> ________________________________




------------------------ Yahoo! Groups Sponsor --------------------~--> 
Fair play? Video games influencing politics. Click and talk back!
http://us.click.yahoo.com/T8sf5C/tzNLAA/TtwFAA/nhFolB/TM
--------------------------------------------------------------------~-> 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 


Reply via email to