Actionscript 3 - First Steps IV

      失落的感情 2005-10-28 10:48

If you have seen our first examples, you may have wondered, if we can do more with a MovieClip than just trace. And yes indeed, the good old drawing api is still intact. It was just pushed down to the member MovieClip.graphics.


package {
import flash.display.MovieClip;

public class Test extends MovieClip {
public function Test() {

var bgColor:int = 0xff0000;
var size:int = 400;
var count:int = 300;
graphics.beginFill(bgColor);
for( var i:int=0; i<count; i++){
graphics.lineTo(
Math.floor(size*Math.random()),
Math.floor(size*Math.random()));
}
graphics.endFill();
}
}
}


Additionally there are new methods like drawRect and drawCircle, which make drawing a lot more convenient these days.


标签集:TAGS:
回复Comments() 点击Count()

回复Comments

{commenttime}{commentauthor}

{CommentUrl}
{commentcontent}