Search code examples
flashquery-stringswfobject

AS2 Parent - Child swf communication


How do I do this?

Inside the parent swf

myVar value is set by query string value loaded in by swfobject

var myVar = _level0.part; // i have the value 123 here ..all good so far


loadMovieNum("childa.swf", 3);

Inside the child swf

var principal = MovieClip(parent.root);

childLog.text = principal.myVar;

or

childLog.text = root.loaderInfo.parameters["part"];

or

childLog.text = _parent._levell0.part;

Always childLog.text is undefined :( - so how to access the value of myvar from the child?

Thanks!


Solution

  • It's actually more simple than your examples:

    childLog.text = _level0.myVar;