View Full Version : containing _global vars from AS2.0 swfs

11-06-2008, 09:34 AM
i posted about this before, and i have some new info. maybe someone will have another pointer for me with my new discovered tactics.

i am trying to load youtube videos into my AS3.0 main.swf

i found out that only one youtube video works at a time, and after a long time studying up on why, found out that youtube swfs use vars in _global space for the player to work with.

if you look at this page: http://livedocs.adobe.com/flex/3/langref/migration.html

it says:
Use a static member of a class instead.

but i guess if you load in a AS2.0 swf, it's still using the virtual machine for 2.0 on those ones. so all their vars go into _global somewhere.

if two swfs are loaded in with colliding _global vars, there are going to be problems.

i recently discovered using the LoaderContext object which has solved a number of my other problems with security and applicationDomain stuff.

but it seems that even if i put the loaded swf into its own new applicationdomain it still puts all the vars into the same _global space.

am i missing something here?

var lc:LoaderContext = new LoaderContext();
lc.applicationDomain = new ApplicationDomain(null);

var myLoader:Loader = new Loader();
myLoader.contentLoaderInfo.addEventListener(Event. COMPLETE, _onLoad);
myLoader.load(new URLRequest('http://www.youtube.com/v/M6K5nONQAcI&hl=en&fs=1'), lc);


11-06-2008, 10:41 AM
To be more specific all the AS2 variables are in the _global object, i.e. custom classes and packages you create are _global variables. I.e. if there was such thing like fully qualified class name in AS2, for MovieClip it'd be _global.MovieClip, for your custom.package.CustomClass it'd be _global.custom.package.CustomClass etc.
I think I've replied to your previous post and I still believe that the problem isn't with overlapping of some variables definitions, but maybe something done on purpose, maybe using LocalConnection or something like that.