3 Replies Latest reply on Apr 2, 2008 7:58 PM by ntsiii

    Simple swf movie control

      I am still getting used to scripting from within Flex. I have a very simple flash movie that indicates a value from 0 to 100% - one frame for each percent. I want to embed that movie into a Flex application and control the swf's position in the timeline from within the Flex application.

      I know that I cannot just use:

      "SWF.gotoAndStop(currentFrame)" or
      "MovieClip(SWF.content).gotoAndStop(currentFrame)" ...

      but I would like to find a simple solution - if one exists. I do not want to create 101 separate swf files and change the source every time I need to change the frame.
        • 1. Re: Simple swf movie control
          ntsiii Level 3
          You can communicate with a loaded SWF through the SWFLoader.content property. This gives you access to any public members of the swf.

          If you implement a public method, like setPos(iPercent:int), you should be able to call that method thropugh the content property.

          Note that there are timing issues wotking with content in a loaded SWF. SWFLoader has to be complete, and you need to listen for the Application.complete event before interacting with the swf.

          If you have difficulty with this, I have an example on www.cflex.net. Search for swfloader.

          • 2. Simple swf movie control
            slaingod Level 1
            You can in fact do that:

            private var movie_clip:MovieClip;
            private var myLoader:SWFLoader = new SWFLoader();

            onInit() {
            myLoader.trustContent = true;

            private function loadHandler(e:Event):void{
            movie_clip= e.target.content;



            // if you have some public methods defined:

            • 3. Re: Simple swf movie control
              ntsiii Level 3
              Cool. Thanks slaingod, you can tell I am not a Flash guy.