Why wouldn't you include the error messages you're getting?
I'll guess that you are loading the swf with a Loader and it's still a child of that loader. You could add it to the parent swf directly in a complete handler for that loader, or you could use parent.parent. But what you should really do is have a function in the loaded swf that takes the value you want as a parameter. Then call that function from the parent swf when you want to. Or you could have a function that saves a local variable with the value and call that in the complete handler.
Let's say you want to keep a value called "foo". You've retrieved this value in the parent somehow, it doesn't matter for this exercise.
loaded swf has code more or less like this:
and the loading swf has code something like this:Code:var foo:String; //loaded swf's foo variable function setFoo(f:String):void{ foo = f; }
Code:var loader:Loader = new Loader(); loader.contentLoaderInfo.addEventListener(Event.COMPLETE, handleComplete); loader.load(new URLRequest("myChild.swf")); function handleComplete(e:Event):void{ var l:Loader = LoaderInfo(e.currentTarget); var clip:MovieClip = MovieClip(l.content); clip.setFoo(foo); }




Reply With Quote
