5 Replies Latest reply on Feb 25, 2007 9:19 AM by kglad

    passing variable to a loaded movie

    David Mok
      Let's say, a movie
      loads an external MovieClip,
      using a MovieClipLoader, and locks
      the root, with code as the
      following:

      //I'd like to pass this variable
      var myVar = "Passed it to Shell";

      this.createEmptyMovieClip("Shell",
      this.getNextHighestDepth());

      var lo:Object = new Object();
      lo.onLoadInit = function(target_mc){
      target_mc._lockroot = true;
      }

      var mcl:MovieClipLoader = new MovieClipLoader();
      mcl.addListener(lo);
      mcl.loadClip("ExternalMovie.swf", Shell);

      //end.

      Now, once Shell is loaded, how
      do I access myVar?

      I tried _parent.myVar, which
      doesn't work. (Since Shell has
      the _root locked.)

      I changed the onLoadInit to

      lo.onLoadInit = function(target_mc){
      target_mc.myVar = myVar;
      target_mc._lockroot = true;
      }

      and then tried to access inside
      Shell by this.myVar, which still
      doesn't work.

      I'd appreciate any suggestions.