2 Replies Latest reply on Feb 24, 2010 12:20 AM by Mainmanian

    playing AS2 SWF fiel in Flash CS4

    Mainmanian Level 1

      Naive question perhaps... Does anyone know how adobe plays the AS2 SWF file so beautifully, including being able to go to next frame or prev frame or zoom functions?

       

      I have tried many different ways to play an AS2 SWF in my flex (AS3) SWF loader and it is a very difficult problem. I use a AS2 Shell as a proxy and I use local connection to communicate between the two AVMs. The result is quite a horrible one because, I am not able to scale the swf very well and also have a torrid time with the debugger.

       

      Does anyone know of any special methods used by Adobe to achieve that in CS4 Flash or do they also use LocalConnection to play the AS2? Thanks

        • 1. Re: playing AS2 SWF fiel in Flash CS4
          kglad Adobe Community Professional & MVP

          localconnection must be used to communicate (directly) between as2 and as3.  i'm not sure what else you're trying to do.

          • 2. Re: playing AS2 SWF fiel in Flash CS4
            Mainmanian Level 1

            Hi Kglad,

             

            I am indeed using LocalConnection. My requirement is to load an AS2 SWF in my flex app and be able to control the playing of the AS2 file. After a lot of research, I found out that the only way to really accomplish that will be load a proxy AS2 shell swf in the main AS3 app using a SWF loader and to communicate with the AS2 shell using LocalConnection. Thru LocalConnection, I then pass the AS2 SWF movie name and have the peoxy shell load the SWF into an empty movie clip and play.

             

            This actually works, sort of. My problem is that I am not able to scale the AS2 SWF movie automatically. I can scale using the _xscale and _yscale properties, but to do taht, I need to know the width and height of the incoming SWF, which I don't know of a way of finding.My attempts to find it using the following code have resulted in bupkiss. the trace statement which attempts to show the width and height of the movie clip show 0 and the stage trace staement gives me the dimensions of the browser. Instead of what I really need is the width and height of the movie "fileName" that is loaded. Any thoughts? Thanks, Ramesh

             

                    __vid = createEmptyMovieClip(__vid, 0);
                    __vid._lockroot = true;
                    __vidMCL = new MovieClipLoader();
                   
                    var mclHandler:Object = new Object();
                    mclHandler.onLoadComplete = function(mc:MovieClip) {
                        trace("wh vals are " + mc._width + "," + mc._height);
                        trace("stage wh vals are " + Stage.height + "," + Stage.width);
                        mc._xscale = 48;
                        mc._yscale = 48;
                        out_lc.send(LC_OUT_NAME(), "onPlayVideoResult", true);
                    };
                    __vidMCL.addListener(mclHandler);
                    __vidMCL.loadClip(fileName, __vid);