This is not strictly a SWFObject question, but one of how Flash works
internally. Generally you will not get help on these types of questions on
this list. That being said:
The root of your loaded Main.swf is different to the root of your preloader.
Here are two solutions to your issue:
1) reference the preloader vars via the parent property
a) On the first frame of Preloader.swf the FlashVars are retrieved from
Preloader.html and Main.swf is loaded into the preloader...
var paramObj:Object = LoaderInfo(this.root.loaderInfo).parameters;
var containerName:String = paramObj.testName;
var containerNumber:int = paramObj.testNumber;
var containerFoo:String = paramObj.testFoo;
var L:Loader = new Loader();
L.load(new URLRequest("Main.swf"));
addChild(L);
b) And on its first frame, Main.swf gets the variables from Preloader.swf...
var loadeeName:String = MovieClip(parent.parent).containerName;
var loadeeNumber:int = MovieClip(parent.parent).containerNumber;
var loadeeFoo:String = MovieClip(parent.parent).containerFoo;
2) pass the vars to Main.swf when loading via the Loader Class:
http://craiggrummitt.blogspot.com/2007/12/preloader-absorbing-application.ht
ml
var ldr:Loader = new Loader();
var url:String = "application.swf";
var urlReq:URLRequest = new URLRequest(url);
urlReq.data=getObjectVariables(this.loaderInfo.parameters)
ldr.load(urlReq);
this.addChild(ldr);
public function getObjectURLVariables(whichObject:Object):URLVariables {
var variables:URLVariables=new URLVariables();
for (var i in whichObject) {
variables[i]=whichObject[i];
}
return(variables);
}
Cheers,
Aran
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of jwerre
Sent: Thursday, 20 November 2008 6:44 AM
To: SWFObject
Subject: get access to flashVars from loaded swf
Anyone have any success in trying to access getting flashVars from a
loaded swf?
I have a preloader.swf which loads main.swf
I can access flashVars from preloader.swf like this: LoaderInfo
(this.root.loaderInfo).parameters
When i try to access them the same way in main.swf it returns
undefined.
anyone with any ideas would be greatly appreciated. Thanks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"SWFObject" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/swfobject?hl=en
-~----------~----~----~----~------~----~------~--~---