文档类: package { import effect.move.MoveAction; import events.ParameterEvent; import flash.display.Sprite; public class Drags extends Sprite { private var dur : int = 2; private var dragSprite : Sprite; private var boxList : Array; private var itemContainer : Sprite; public function Drags() { itemContainer = new Sprite(); addChild(itemContainer); boxList = new Array(); for(var i : int = 0 ; i < 20 ; i++) { var box : Box = new Box(); box.index = i; box.x = i % 5 * (box.width + dur); box.y = Math.floor( i / 5 ) * (box.height + dur); itemContainer.addChild(box); boxList.push(box); } boxList[0].loadImg("2.jpg"); boxList[1].loadImg("2.jpg"); dragSprite = new Sprite(); itemContainer.addChild(dragSprite); for(var j : int = 0 ; j < boxList.length ; j++) { (boxList[j] as Box).setDefault(dragSprite , boxList); } MoveAction.getInstance().addEventListener(MoveAction.MOVE_END , __moveEnd); } private function __moveEnd(e : ParameterEvent) : void { boxList[boxList[0].moveIndex].moveEnd(); GC.clear(); } } } 源文件下载:http://download.csdn.net/source/2334912