Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

determine is MovieClip playing now

I have movieClip (in as3) and I'd like to know is this movieClip playing now

How can I do this?

like image 939
takayoshi Avatar asked Jan 19 '23 23:01

takayoshi


1 Answers

As crazy as it is, there is no built in way to do this (although it should be). Two options have a flag that you swap when play/stop is called.

var mc_playing:Boolean = false;

mc_playing = true;
mc.play();



mc_playing = false;
mc.stop();

Or you could extend the MovieClip class to create your own playing property.

class SuperMovieClip extends MovieClip {
    private var _playing:Boolean = false;

    public function SuperMovieClip() {

    }

    override public function play():void {
        _playing = true;
        super.play();
    }

    override public function stop():void {
        _playing = false;
        super.stop();
    }

    public get function playing():Boolean {
        return _playing;
    }

}

Then just make your mc link to SuperMovieClip instead of MovieClip

like image 157
Chris Avatar answered Jan 25 '23 13:01

Chris