Access variable in MainTimeLine

I have preloader tha loads another swf, lets say game.swf.
How can I access preloader’s variable from game.swf?

The first question you should be asking is, does my game need to care about how its loaded? Why does it need to access the preloader (if there is one?) at all? The more self contained your swf is, the better.

Anywho, you can go through the loaderInfo property and access loader there. That should get you the Loader that’s loading the swf (the one in the preloader) which can in turn get you anywhere in your preloader DOM as that loader would likely be a child of that swf’s display list.

Seems like ye olde root would likely work in this non-ideal scenario too. panoss is probably just grabbing some parameters from the preloader for some reason, and maybe game.swf can assume root is available.

All the suggestions you gave seem good to me…

I 'm trying to make it work with MovieClip(root):

//this code in the game
var m:MovieClip = MovieClip(root);
trace (“m.appRoot=” + m.appRoot);

But it gives error: m.appRoot=undefined…

I 'm loading the game with the loader of as3: (maybe this matters, that’s why I mention it)

// this code is in the preloader
var appRoot=“localhost”;
// load game
var request:URLRequest = new URLRequest(“game.swf”);
var _loader:Loader = new Loader();
_loader.contentLoaderInfo.addEventListener(ProgressEvent.PROGRESS, onProgress);
_loader.contentLoaderInfo.addEventListener(Event.COMPLETE, onLoaded);
_loader.load(request);

Also “trace(root as MovieClip).appRoot);” gives me the same error.