1 Reply Latest reply on Nov 30, 2010 3:18 AM by aobsz

    SWFLoader cannot access content of swf created in CS3

    aobsz

      Hi

       

      I am using Flex Builder 4. I have an swf animation created in CS3 (AS2) and is loaded into a Flex skin component:

       

      <fx:Script>

      <![CDATA[

         private function changeAnimationText(event:Event):void

         {

            var thisAnimation:MovieClip = animationLoader.content as MovieClip;

            thisAnimation.changeText("Testing...");

         }

      ]]>

      </fx:Script>

       

      <mx:SWFLoader id="animationLoader" complete="changeAnimationText(event)" />

       

      The script in the host component uses animationLoader.load(_urlOfAnimationFile);

      The swf did get loaded and I can see the animation playing on screen, but somehow

      I cannot access its contents.  I need to access the swf functions.

       

      I have tried catching the INIT and COMPLETE events, and in the event handlers, I put

      var thisAnimation:MovieClip = animationLoader.content as MovieClip;  Still, no luck.

      The object "thisAnimation" is null.

       

      I also tried putting applicationComplete="someFunctions()" inside the main Application:

       

      <s:Application xmlns= ......

                            applicationComplete="aFunction()">

       

      And in "aFunction", I tried to create the MovieClip object "thisAnimation" again, but still the object is null.

       

      I have been working this for the whole day, and not sure what the problem is.

       

      Any help will be appreciated!

       

      Thanks in advance!

       

      aobs