O'Reilly logo

ActionScript Graphing Cookbook by Peter Backx, Dominic Gélineau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Animating a meter

We will start from the Drawing meters and gauges recipe in Chapter 4, Drawing Different Types of Graphs and we will animate it using the TweenLite animation engine.

Getting ready

Get the code from the recipe previously mentioned and we will modify it to make it animated.

How to do it...

  1. The first step would be to go to http://www.greensock.com and download the ActionScript 3 library.
  2. Add the greensock.swc file to the lib folder in the project.
  3. In FlashDevelop, right-click on greensock.swc and choose Add To Library.
  4. We are now ready to use TweenLite in our code. In Meter.as, we will set alpha to zero so that we can animate it.
  5. To do so we will add the animateIn and the arrowTo functions:
    public function animateIn():void { TweenLite.to(this, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required