トップ 差分 一覧 Farm ソース プレゼンテーション 検索 ヘルプ PDF RSS ログイン

sprite

表示


var container1:Sprite = new Sprite();

var circle1:Sprite = new Sprite();
circle1.graphics.beginFill(0xFFCC00);
circle1.graphics.drawCircle(50, 80, 40);
var box1:Sprite = new Sprite();
box1.graphics.beginFill(0x00CCFF);
box1.graphics.drawRect(50,70,100,80);
box1.graphics.endFill();

container1.addChild(circle1);
container1.addChild(box1);
addChild(container1)



var container:Sprite = new Sprite();
addChild(container);

var circle:Sprite = new Sprite();
var cx:int = 100;
var cy:int = 100;
var r:int = 70;
circle.graphics.beginFill(0xFFCC00);
circle.graphics.drawCircle(cx, cy, r);
var triangle:Sprite = new Sprite();
var tx:int = 170;
var ty:int = 50;
var tw:int = 100;
var th:int = 150;
triangle.graphics.beginFill(0xFF0000);
triangle.graphics.moveTo(tx, ty);
triangle.graphics.lineTo(tx+tw/2, th);
triangle.graphics.lineTo(tx-tw/2, th);
triangle.graphics.endFill();
var box:Sprite = new Sprite();
var bx:int = 60;
var by:int = 80;
var bw:int = 100;
var bh:int = 100;
box.graphics.beginFill(0x00CCFF);
box.graphics.drawRect(bx,by,bw,bh);
box.graphics.endFill();

container.addChild(circle);
container.addChild(triangle);
container.addChild(box);

container.addEventListener(MouseEvent.CLICK, clicked);
function clicked(event:MouseEvent):void {
container.removeChild(DisplayObject(event.target));
trace(container.numChildren);
}


[Flash,ActionScript3.0,表示]