1 Reply Latest reply on Jul 21, 2010 12:31 PM by iowaGuy

    Controlling external SWF

    iowaGuy Level 1

      hello - i am running into a problem and was wondering if someone could point me in the right direction. I am using AS3 / CS3 - I have a FLEX component that is complied into a swf and i am loading it into my Flash file. This component has some properties that you can set, but I am not sure how to reference the newly loaded SWF file. I have my current code below - with one of the properties the FLEX programmer sent over:

       

      var request:URLRequest = new URLRequest("qagGauge.swf");
      var loader:Loader = new Loader();
      loader.load(request);
      addChild(loader);

       

      /* PROPERTIES

       

      [Bindable] public var fontColor:Number = 0xFFFFFF;

       

      */

       

       

      Thanks in advance!

        • 1. Re: Controlling external SWF
          iowaGuy Level 1

          solved:

           

          import flash.display.Loader;

          import flash.net.URLRequest;

          import flash.events.TimerEvent;

          import flash.display.MovieClip;

           

          var _swfTimer;

          var _loader:Loader = new Loader();

          _loader.load(new URLRequest("qagGauge.swf"));

          _loader.contentLoaderInfo.addEventListener(Event.COMPLETE,loadIt);

          addChild(_loader);

           

           

          function loadIt(e:Event):void

          {

              _swfTimer = new Timer(10);

              _swfTimer.addEventListener(TimerEvent.TIMER,checkSwfLoader);

              _swfTimer.start();

          }

           

          function checkSwfLoader(e:Event):void

          {  

              var myclip:MovieClip = _loader.content as MovieClip;

              if (myclip.application != null)

              {

                  _swfTimer.stop();

           

                                          myclip.application.maxVal = 1000;

                                          myclip.application.faceColor = 0x000000;

              }

          }