Brand new property MovieClip.isPlaying
I have discovered recently the new isPlaying property for the MovieClip class that Adobe introduced in Flash Player 11.
I do recommend you read What’s New in Flash Player 11 where you will find interesting new features like this one.
It’s great we finally have an easy way to know if our animations are running or simply stopped.
Take a look at the following code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import flash.events.Event; import flash.events.MouseEvent; this.addEventListener(Event.ENTER_FRAME, onLoop); stage.addEventListener(MouseEvent.CLICK, onClick); mc.play(); function onLoop(e:Event):void { txtInfo.text = mc.isPlaying ? "MovieClip playing!" : "MovieClip stopped"; } function onClick(e:MouseEvent):void { if (mc.isPlaying) { mc.stop(); } else { mc.play(); } } |
As we see the use of this property keep things very simple and this is really welcome! Quite surprising this has not been available before.
Note the mc.play() in line 7. It seems this property does not know the MovieClip is playing by default, and the value gets updated when we use the MovieClip playback functions such as play(), stop() and so on…
If you are going to use the isPlaying property ensure to use those functions to have the correct value.
This is the result of the above code (Flash Player 11 required):
You can download this example in Flash CS5 here.
UPDATE: I forgot to mention you need to target Flash Player 11 in your Flash IDE. This is not available by default in Flash CS5 or CS5.5 as you can only select up to Flash Player 10.2. In order to add Flash Player 11 follow the instructions explained here.
Important: If you run the movie within the Flash IDE it won’t work. The movie will be played by Flash Player 10.2. Test your published SWF file in your browser. You can now download the Release/Debug Flash Player 11.1 from the Adobe website here.




If you have ever tried game development surely you noticed how important the management of the images is. A 2D game involves lots of images for the animations of our characters.
Cool stuff is what we find in this new release of FDT from PowerFlasher.
Adobe just shared the sneak peeks of Adobe MAX 2011. We can see some new cool features that we may have available in Adobe products. They are doing an amazing work!