3 Replies Latest reply on Apr 17, 2007 3:09 AM by kglad

    Is flash playing?

    jorkri

      I have spent a lot of time trying to find out if it is possible to detect if a flash 8 file is playing or if it has stoped. Basicly I need a property (boolean) in the MovieClip class like "isPlaying". In earlyer versions of flash I have extended the play - stop - gotoAndPlay - gotoAndStop functions and applied code that sets a boolean value, but I have not succeeded in doing so in Flash8. There are several solutions like using onEnterFrame, and intervals to check for diffrences in _current frame, but I'm looking for a more "clean" code. In my project I am loading several swf's therefore I cannot create an extended version of the MovieClip, unless it is possible to modify the class files in "Firs Run\Classes\FP8"

      I was supprised not to fint much about this issue, please let me be adviced if you have any experiences in this concern.

        • 1. Re: Is flash playing?
          kglad Adobe Community Professional & MVP
          you can extend those methods for a custom movieclip class and assign your boolean for that class. or you can still use the prototype method extension to add new methods to all movieclips that will assign your boolean.
          • 2. Re: Is flash playing?
            jorkri Level 1
            I guess it is possible, but I still dont see how.

            In my project I have to flash files, a main file which I embed in html, and a "sub" file which is beeing loaded into a container. In earlyer versions of my project I had a code in the first keyframe of the sub file, which was simular to this:

            this.play_org = function = play;
            play = function () {
            this.play_org();
            this.m_bPlaying=true;
            }

            I olso had simular to the above code for stop - gotoAndPlay - gotoAndStop. The main flash file checks on diffrent intervals if the sub movieclip is playing, and triggers diffrent events based on the result.

            The old code does not work in flash 8, so I have to find another way/code. Do you know if it is possible to re-write the code in the folder "Firs Run\Classes\FP8" that adds the above functionality to all flash files I create?

            • 3. Re: Is flash playing?
              kglad Adobe Community Professional & MVP
              don't mess with the flash class files. they can be easily extended without messing with your core files.

              for example, you can use the following to add two new methods to the movieclip class. playF() and stopF() do exactly what play() and stop() do, plus they assign your boolean. add similar protoype statements for the goto methods and you have what you seem to be wanting.

              you should note some limitations, however. your approach will return true if a one frame movieclip has had a playF() method applied. your approach will return undefined for a movieclip that has none of the custom methods applied. and that includes a movieclip that is multiframe and has no stopF() in its first frame.

              that said, you can use: