Quick Tip: Create a Minimalistic SandClock Using ActionScript 3

Read through the easy steps in this Quick Tip to create a Minimalistic SandClock with ActionScript.


Final Result Preview

Let's take a look at the final result we will be working towards:


Step 1: Brief Overview

Using Arrays and a premade square MovieClip we will create a SandClock that will be animated by a Timer.


Step 2: Set Up Your Flash File

Launch Flash and create a new Flash Document, set the stage size to 400x250px and the frame rate to 24fps.


Step 3: Interface

This is the interface we'll be using, the squares in the image are actually one single blue square MovieClip exported for use with ActionScript, with a linkage name of Square. A simple button named startButton will be used to build and start the clock.


Step 4: ActionScript

Create a new ActionScript Class (Cmd+N), save the file as Main.as and write the following lines. Read through the comments in the code in order to fully understand the class behavior.

You can adjust the Timer and the counter value to make the sandclock duration greater or shorter.


Step 5: Document Class

Remember to add the class name to the Class field in the Publish section of the Properties panel.


Conclusion

Why not use this SandClock to give your application or game a nice touch?

I hope you liked this tutorial, thank you for reading!

Tags:

Comments

Related Articles