我是as3的新手,我正在尝试编写一个必须绘制内容的类...我无法弄清楚你是如何设置代码的?
播放器/ Player.as:
package player {
import flash.display.Sprite;
public class Player extends Sprite {
public var loader = null;
public function Player(){
this.cnstr_loader();
}
private function cnstr_loader(){
this.loader = new Sprite();
addChild(this.loader);
this.loader.graphics.lineStyle(1,0x000000);
this.loader.graphics.beginFill(0x0000FF);
this.loader.graphics.drawRect(0,0,10,10);
this.loader.graphics.endFill();
this.loader.x = 10;
this.loader.y = 10;
trace('e');
}
}
}
main.as:
import player.Player;
var _Player = new Player();
如何在自己的movieclip或sprite或其名称中绘制整个Player类?