yoolek as3 flash cms

4Apr/090

swap depths + attachMovie in as3

AS3 SwapDepths Equivalent + attachMovie
as2 to as3 swapDepths() +attachMovie
action script 3 swap depths attach movie

create movie clip with linkage "Box"

This movie requires Flash Player 9


download

function SwapDepths(e:MouseEvent):void {
	this.setChildIndex(Box(e.target), (this.numChildren - 1));
}
function addBoxes():void {
	for (var i:int = 0; i <3; i++) {
		var colorTransform:ColorTransform = new ColorTransform();
		colorTransform.color = (Math.random() * 0xFFFFFF);
		var box:Box = new Box();
		box.x =  ((i * 50) + 5);
		box.y = ((i * 20) + 5);
		box.transform.colorTransform = colorTransform;
		box.buttonMode = true;
		box.addEventListener(MouseEvent.MOUSE_DOWN, SwapDepths);
		this.addChild(box);
	}
}
addBoxes();

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.