0 Replies Latest reply on Jun 21, 2007 12:35 PM by Gil1

    Communication from a flex app. to a swf loaded inside it at runtime

    Gil1
      I am loading a swf (made with Flex 2) inside another flex application using the SWFLoader as:

      <mx:SWFLoader id="swfLoader1" source="Modules.swf" width="100%" height="100%"/>

      the swf ("Modules.swf' ) loads as expected, but form the parent movie I want to be able to control (change values of variables) parameters on the child swf (swfLoader1).

      When a click a button in the host movie I want to change the text on a label on the child movie, but it is not working for me.

      I have done this:
      when clicking the button call a function doStuff()

      public function doStuff():void
      {
      var myMovie:* = swfLoader1.content;
      myMovie.mod1_desc.text = "blah blah";
      }

      But it's not working. Then I tried

      public function init():void
      {
      _loader = new Loader;
      extContent.addChild(_loader);
      _loader.contentLoaderInfo.addEventListener(Event.INIT, doStuff);
      _loader.load(new URLRequest("Modules.swf"));

      }

      init() is called from creationComplete on the Application (MXML) and when the _loadr is loaded it calls the doStuff function above. Again is not working.

      Any suggestions on how to do this right?

      Gilbert