7 Replies Latest reply on May 2, 2008 11:32 AM by rcrocker922

    SWFLoader troubles

      Ok, so I'm having some troubles with the SWFLoader. Does anyone know of a way to use an SWFLoader to be able to play and stop the content within? Unfortunately the SWF i'm loading into the SWFLoader is an Adobe Captivate presentation, so I don't have any properties or methods I can access within it to play or stop it. If anyone has any ideas of how I could do this, I'd appreciate it. Thanks!
        • 1. Re: SWFLoader troubles
          rcrocker922 Level 1
          Anyone have any ideas? All I need to do is access the timeline controls of the SWF being loaded into the SWFLoader, such as play(), gotoAndPlay(), stop(), etc. Is there another way I should be doing this? I don't understand why the SWFLoader does not include this functionality.
          • 2. Re: SWFLoader troubles
            Gnomann Level 1

            Not sure exactly what format the Adobe Captivate presentation is (an SWF?). But if it is equivalent to (or treated as) an older Flash (.swf) movie (F8 or previous) it might be loaded as an AVM1Movie instance, and thus all the methods of that piece cannot be accessed (only basic properties). It can't be played/etc -- only positioned/rotated as a static DisplayObject.

            Check out AVM1Movie class in the docs.

            If that's the case, if there's any way to get the Adobe Captivate file to be saved as an F9 (AS3) SWF file, then you'll probably be able to play the movie at will, and access all its MovieClip methods.

            Hope that helps.
            • 3. Re: SWFLoader troubles
              rcrocker922 Level 1
              It is being isntantiated as an AVM1Movie. I exported from Captivate as a Flash Player 9 SWF.

              So, I'm guessing that the SWF it is exporting really isn't for Flash Player 9 then? I'm going to go ask this question in the Captivate forum.

              Thanks for the reply Gnomann.
              • 4. SWFLoader troubles
                Captivate is normal swf format - at least version 2 was when I worked with Captivate.

                I've recently done a project where I had to load and 'talk' to functions (stop a movie, stop audio) within in the sub-swf.

                I'll post the functions where I controlled the sub-swfs. Post back if I need to clarify.

                Here's one function that set up the channel to talk to them:
                private function addSingleSwf():Boolean {
                var returnVal:Boolean = false;
                var urlToLoad:String = GlobalScopedVars.ZOOMED_IN_SWF_PATH;

                if (GlobalScopedVars.SINGLE_SWF_IS_EXTERNAL && !GlobalScopedVars.ZOOMING_NOW) {
                try {

                _singleSwfLoader = new Loader();
                try {
                var url:URLRequest = new URLRequest(urlToLoad);


                } catch (err:Error) {
                trace("error in swfPath - first level:\n" + err.message);

                _singleSwfLoader.contentLoaderInfo.addEventListener(IOErrorEvent.IO_ERROR, addIOERRHandler);
                _singleSwfLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, addCompleteListener);
                returnVal = true;

                } catch (err:Error) {
                trace("error loading single swf:\n" + err.message);
                returnVal = false;
                else {


                return returnVal;

                Here's where I had to disable content before I did a removeChild(movieClip) (aka, 'unload') the content which shows how to first check to see if a function/property exists & then if it does, to do something with iit.

                private function performAssetUnload(_action:String):void {
                switch (true) {
                case (_action == "audio"):
                //trace("shutting off audio");
                if (Object(_singleSwfLoader.content).hasOwnProperty("channel")) {
                case (_action == "video"):
                if (Object(_singleSwfLoader.content).hasOwnProperty("stopVideoMC")) {
                case (_action == "timer"):
                if (Object(_singleSwfLoader.content).hasOwnProperty("stopTimer")) {
                //trace("stopping timer");



                Good luck!

                • 5. Re: SWFLoader troubles
                  rcrocker922 Level 1
                  Thanks for the reply Matt. I tried it, but it dosen't work. The docs say that the content property is read-only. Even still, I know the variables are there, but when I try to access them with hasOwnProperty() it still returns false that the variable isn't there.
                  • 6. Re: SWFLoader troubles
                    slaingod Level 1
                    There are a number of SWFLoader examples found in these forums on how to do this (serch for gotoAndPlay probably). However, the caveat is that these would need to be AS3 SWF's. I would first verify if Captivate is producing AS3 swf's.

                    In the event that it produces AS2 swf's, you will probably need to create an AS2 proxy SWF that does the communication you need for you, and then use LocalConnection to do the communication between your proxy and your Flex app. Be careful when using LocalConnection tho, that you create unique identifiers for the connection name (using flash vars presumably), or you will find that having you Flex app open on multiple Tabs/Windows in a browser will not work properly.
                    • 7. Re: SWFLoader troubles
                      rcrocker922 Level 1
                      I have actually verified that Captivate is NOT producing AS3 SWF's. Even though, it gives you the option, it is still producing a AS2, FP7, AVM1 - SWF. Thanks for the tip on using the LocalConnection though, I will give that a try.