1、IDE的做法:http://ask.layabox.com/question/1261
2、代码的写法:
[code]var sprite:Sprite = new Sprite();
sprite.graphics.drawRect(100,100,100,100,"#ff9900");
var hitarea:HitArea = new HitArea();
var graphics:Graphics = new Graphics();
graphics.drawRect(100,100,100,100,"#ff9900");
hitarea.hit = graphics;
sprite.hitArea = hitarea;[/code]