Drawing in ActionScript3

We can create a MovieClip or Sprite and draw on it. In this movie, we add a Sprite above the snowman, and then draw 2 buttons on the Sprite. We did not actually draw on the snowman.

snowmansnowman with buttons

Experiment: Download the movie and write the code to add more buttons to the snowman.

Instead of drawing the dots automatically, let the user click to add dots.

1
2
3
4
5
6
7
var myPicture:Sprite = new Sprite();
addChild(myPicture);
myPicture.x=snowman.x;
myPicture.y=snowman.x;
myPicture.graphics.beginFill(0x00000); //black
myPicture.graphics.drawCircle(60,50,4); //first button
myPicture.graphics.drawCircle(60,70,4); //second button
CODE

NEXT: Drawing Graphs in ActionScript3