ActionScript 3 AS3简单网格布局

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ActionScript 3 AS3简单网格布局相关的知识,希望对你有一定的参考价值。

// Demo for this example at http://adamcoulombe.info/lab/as3/gridlayout.html

//Download these classes at http://www.greensock.com/tweenlite/
import com.greensock.TweenLite; 
import com.greensock.easing.*;




var gridItems = new Array();
var grid = new Sprite();
grid.x = 65;
grid.y = 50;
addChild(grid);

for (var i:int = 0; i < 20; i++) {
	gridItems[i] = new MyBox();
	gridItems[i].x = (i % 5) * (gridItems[i].width );
	gridItems[i].y = int(i / 5) * (gridItems[i].height);
	gridItems[i].addEventListener(MouseEvent.MOUSE_OVER,gridItemOver);
	gridItems[i].addEventListener(MouseEvent.MOUSE_OUT,gridItemOut);
	grid.addChild(gridItems[i]);
}
function gridItemOver(e){
	grid.addChild(e.currentTarget);
	TweenLite.to(e.currentTarget,0.5,{scaleX:1.2, scaleY:1.2,ease:Elastic.easeOut});
}
function gridItemOut(e){
	TweenLite.to(e.currentTarget,0.5,{scaleX:1, scaleY:1,ease:Elastic.easeOut});
}

以上是关于ActionScript 3 AS3简单网格布局的主要内容,如果未能解决你的问题,请参考以下文章

ActionScript 3 AS3:创建一个Bottons网格

AS3简单网格布局

ActionScript 3 在网格布局中定位显示对象

ActionScript 3 简单的TextFormat Manager AS3

ActionScript 3 AS3绘制一个简单的矩形蒙版

ActionScript 3 简单的Flash AS3画廊/幻灯片