1 Reply Latest reply on Dec 20, 2006 12:35 PM by frenchi30

    SwfLoader and interacting with swf

    frenchi30 Level 1
      Hi All,
      This should be an easy one, but I cannot find what I am doing wrong.
      I am loading a swf file with SwfLoader, I want to control some movieclips and variables inside the loaded swf.
      So far from what I gathered I have to :
      1 - load the swf
      2 - Once loaded, cast it to a MovieClip
      3 - Then control what I want inside it

      Problem is after it is casted, I try to see the swf or access anything in it and get NULL when I trace...

      Here is the code:

      <mx:Script>
      <![CDATA[
      private function initSwf():void {
      var swfContent:MovieClip = MovieClip(myLoader.content);
      trace(swfContent);
      trace(swfContent.myVar)
      trace(swfContent.myMC)
      }
      ]]>
      </mx:Script>
      <mx:SWFLoader id="myLoader" source="file.swf" creationComplete="initSwf();"/>

      Why are trace(swfContent); trace(swfContent.myVar); trace(swfContent.myMC) coming back null?
      I suspect maybe that the creationComplete is not really a "swf onload complete" call.. but from what I read it is.

      What am I doing wrong? Can anyone help me please?
      Thank-you very much