Here is another class that I wrote thanks to this old tutorial. This is similar to the Arc class except that it draws wedges instead. These are great for doing lightweight charting stuff. You can get the code at my Google Code repository. The example below rapidly animates new wedge shapes creating a cool effect. You can click on the image below to check it out.

Below is the source code for the above example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import com.leebrimelow.drawing.*;
import com.leebrimelow.utils.*;

var bmd:BitmapData = new BitmapData(600, 400, true, 0x000000);
var bm:Bitmap = new Bitmap(bmd);
addChild(bm);

function createArc():void
{
    var sp:MovieClip = new MovieClip();
    sp.radius = Math2.random(20, 400);
    sp.endAngle = Math2.random(130, 400);
    sp.color = Math.random() * 0xFFFFFF;
    sp.count = 0;
    sp.filters = [new DropShadowFilter(10, 45, 0x000000, 0.5)];
    sp.addEventListener(Event.ENTER_FRAME, loop);
    addChild(sp);
}

addEventListener(Event.ENTER_FRAME, loop);

function loop(e:Event):void
{
    var sp:MovieClip = e.target as MovieClip;
    sp.graphics.clear();
    sp.graphics.beginFill(sp.color);
    sp.graphics.lineStyle(5, 0x000000);
    Wedge.draw(sp, 300, 200, sp.radius, sp.count, 0);
    sp.count += 20;
    if(sp.count > sp.endAngle)
    {
        sp.removeEventListener(Event.ENTER_FRAME, loop);
        bmd.draw(sp);
        removeChild(sp);
            sp = null;
        createArc();
    }
}

createArc();

Lee