3 Replies Latest reply on Jul 27, 2008 11:26 PM by fakitol

    In Flex 3 how to Stop and Replay .swf animation created in Flash

      I have an animation file that is created in Flash (I think CS3). In Flex if I import it inside a SWFLoader or if I import it as an Image. It plays once and stops. Then I can not replay it. I also can not pause it when its playing.

      I have tried few things based on help and code available in the Web to of no help. I have tried to convert the swfLoader instance to a movie clip like so to stop

      var c:MovieClip = swfLoaderHeaddress1.content as MovieClip;

      <mx:SWFLoader x="53" y="116" width="206" height="255.3"
      source="assets/animations/curatorial/ZoomHeadress_2nd.swf" id="swfLoaderHeaddress1"/>

      It does not work.

      I have not created the .swf animation, I am not sure how it is done. I belive it may not be using any ActionScript as I know the artist who created it does not know ActionScript. Does something need to be done inside the Flash to support the stop and play? Or is there a way to restart/replay stop a .swf animation in Flex 3 no matter how (and whether or not its developed using ActionScript) its developed in Flash?
        • 1. Re: In Flex 3 how to Stop and Replay .swf animation created in Flash
          You can use LocalConnection class.
          But in this case you may need to have an access to swf's fla file, because using local connection supposes that you have necessary corresponding code in your swf.
          If you do not have that fla file but you have the swf file: you may use "Sothink SWF Quicker" program to add code and corrections to your swf.
          • 2. Re: In Flex 3 how to Stop and Replay .swf animation created in Flash
            anurag_atl Level 1
            I can get the .fla file from the Artist who developed the animation. But does not she have to add some ActionScript code to support the use of LocalConnection class to play() and stop() the animation. Now she does not have any ActionScripting in her animation.

            Also does she need to install Flex Component Kit for Flash CS3 ( http://blogs.adobe.com/flexdoc/pdf/swf9.pdf ) to add LocalConnection class or whatever else sopport that is needed inside the .swf animation for my Flex code to stop and replay her animation? Text
            • 3. In Flex 3 how to Stop and Replay .swf animation created in Flash
              fakitol Level 1
              One way is she has to add some AS code to the animation, or you can do it yourself.
              In swf there must be something like this:
              var connReciever:LocalConnection = new LocalConnection();
              connReciever.client = this;
              function myFunction(parameter:SomeClass):void {...}

              And in Flex:
              var connSender:LocalConnection = new LocalConnection();
              connSender.send("fromFlexToSWF", "myFunction", [..args]);

              The other way: in case with just play/stop there is a way to resolve this by using that Flex Component Kit (or maybe "Flex Skin Design Extension", i do not remember), it is something like she just adding labels to animation frames then she exports it with Flex Kit and then you can work with it like with an object with "states".