I have a A.swf which loads B.swf onto a movieclip and needs to pass it some FlashVars. When loading B.swf with html, I can pass FlashVars fine. When passing from A.swf, it g
It's not necessary that "A" pass FlashVars to "B". Just have B access the FlashVars itself. The following will work whether B is inside of A, or top-level itself:
Add an ADDED_TO_STAGE event listener in B's constructor. e.g.:
function B(){
this.addEventListener(Event.AddedToStage, onAddedToStageHandler);
}
When you have access to the stage you can now access the FlashVars in A this way:
To properly see a variable called myVar flashVar in B.swf, you do (inside B):
private function onAddedToStageHandler(){
var flashVars : Object = LoaderInfo(this.stage.loaderInfo).parameters;
// now you have access to your flashVars!
trace(flashVars.myVar);
}
stage.loaderInfo is what you need to look at.