0 Replies Latest reply on Dec 18, 2006 2:23 PM by dyx4e

    AS3 Question

    dyx4e
      Hi
      Here is my problem:
      I have a file main.swf, which loads another file content1.swf. I want to control(create) symbols that are located in library of content1.swf from document class file of main.swf. Could it be done?


      In library of content1.swf I have a symbol MySymbol with linkage to a coresponding MySymbol.as file:

      public class MySymbol extends MovieClip
      {
      public function MySymbol ()
      {
      trace("MySymbol Created")
      }
      }


      Document class file for main.swf is Main.as :

      public class Main extends MovieClip
      {
      public function Main ()
      {
      var loader:Loader = new Loader();
      configureListeners(loader.contentLoaderInfo);
      var request:URLRequest = new URLRequest("content1.swf");
      loader.load(request);
      addChild(loader);
      }

      private function configureListeners(dispatcher:IEventDispatcher):void
      {
      dispatcher.addEventListener(Event.COMPLETE, completeHandler);
      }

      private function completeHandler(event:Event):void
      {
      var symbol:MySymbol = new MySymbol();
      addChild(symbol)
      }
      }
      When I execute the code I receive following result

      ReferenceError: Error #1065: Variable MySymbol is not defined.