6 Replies Latest reply on Aug 25, 2007 5:21 PM by SPGAnne

    attachMovie with AS3 inside a class using a string

    SPGAnne Level 1
      I am slowly migrating from AS2 (which I was a mere newbie at) to AS3 and my brain is starting to hurt a bit. I have a class which is loading an external .swf (I managed to migrate my MovieClipLoader stuff to the new Loader (ta da), but once the .swf is loaded I want to in turn load a symbol from the library using a string that I pass to my method.
      For example....
      private var mySymbolName:String;// this changes based on another method which sets it
      // here's part of the code for loading the .swf which works fine...
      ...
      my_ldr.contentLoaderInfo.addEventListener(Event.INIT,loadInitHandler);
      my_ldr.load(request);
      container_mc.addChild(my_ldr);
      //here's where I'm stuck...

      private function loadInitHandler(e:Event):void{
      contents_mc = container_mc.addChild(new mySymbolName());
      }

      I know the loader is working fine because if I put a symbol from the loaded .swf on the stage it shows up. And I know the new "linkage" equivalent works because when I put the code this.addChild(new MySymbol()); on the main timeline of the .swf I'm trying to load and then test that the MySymbol loads up just fine. So clearly I need to use some different syntax or something to use the new mySymbolName () stuff.

      I also tried new mySymbolName as Class() and that didn't do the trick.

      HELLLLLPPPPPPP!