If you are loading one movie to another use following technique:

Main movie
Main movie variable defined:
        Var testVar:String = "Hello world";

External movie loaded to level 1:
External movie variable defined:
        Var testVar:String = "Hello world - external";

Now let's load external movie to level 1:
        Trace(_level0.testVar) prints "Hello world";
        Trace(_root.testVar) prints "Hello world - external";
        Trace(_level1.testVar) prints "Hello world - external";

Then same external movie we'll load to some mc called "container_mc" which
located on the main movie timeline:
        Trace(_level0.testVar) prints "Hello world";
        Trace(_root.testVar) prints "Hello world";
        Trace(_root.container_mc.testVar) prints "Hello world - external";
        Trace(_level0.container_mc.testVar) prints "Hello world - external";

Hope it will help you to undestand Flash scope

Igor V. aka The Helmsman

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Rifled
Cloaca
Sent: Wednesday, July 19, 2006 5:29 PM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] How to embed metadata in SWF files?

Are you simply opening the SWF file directly, or loading it into a wrapper
SWF?

If you're loading it directly... it's just

_root.var1
_root.var2
...

If you're loading it into a wrapper, like so:

_root.myClip.loadMovie("path/to/my/movie.swf");

once it loads, you'll be able to access the data with:

_root.myClip.var1
_root.myClip.var2
...

Make sure your movie has loaded.  Use the MovieClipLoader class and assign
an onLoad handler to access the variables.

-rc


On 7/18/06, Jeff Stearns <[EMAIL PROTECTED]> wrote:
>
> I don't have any problems getting variable assignments into the SWF 
> file.
>
> I have problems accessing their values when I'm playing the movie.
>
> The SWF contains some ActionScript in frame 1 which sets variables 
> like title="My First Movie", year=2006.
> But how can my Flash player access those variables when it loads and 
> plays the movie?  Are they in some oddball namespace like 
> _root.somethingOrOther....
>
> thx, jeff
>
>
> On Jul 18, 2006, at 3:11 PM, Rifled Cloaca wrote:
>
> > Or you could create a SWF using MTASC or the Flash IDE, and replace 
> > the variables after it is published like this guy does:
> >
> > http://www.neurofuzzy.net/2005/01/27/swf-recombination/
> >
> >
> > On 7/16/06, Mike Britton <[EMAIL PROTECTED]> wrote:
> >>
> >> I would build a "wrapper" MovieClip class extension for your 
> >> compiled SWF, and use LocalConnection to send/receive the values.  
> >> That is, use LocalConnection in both the compiled swfs and in the 
> >> wrapper.  The wrapper is the receiver and the compiled clips are 
> >> the broadcasters.
> >>
> >> http://www.osflash.org/localconnection
> >>
> >> hth,
> >>
> >> Mike
> >> _______________________________________________
> >> Flashcoders@chattyfig.figleaf.com
> >> To change your subscription options or search the archive:
> >> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >>
> >> Brought to you by Fig Leaf Software Premier Authorized Adobe 
> >> Consulting and Training http://www.figleaf.com 
> >> http://training.figleaf.com
> >>
> > _______________________________________________
> > Flashcoders@chattyfig.figleaf.com
> > To change your subscription options or search the archive:
> > http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
> >
> > Brought to you by Fig Leaf Software
> > Premier Authorized Adobe Consulting and Training 
> > http://www.figleaf.com http://training.figleaf.com
>
> _______________________________________________
> Flashcoders@chattyfig.figleaf.com
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training 
> http://www.figleaf.com http://training.figleaf.com
>
_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to