package { import flash.display.MovieClip; import flash.display.Sprite; import flash.events.Event; import flashx.textLayout.formats.BackgroundColor; import spark.effects.interpolation.RGBInterpolator; public class Map extends Sprite implements IMap { //格子的宽高 private var grid:int = 20; private var hitArr:Array = new Array(); public function Map() { var mapArray:Array; mapArray = MapArray.getMapArr(1); initMap(mapArray); } private function initMap(tempArray:Array):void{ for (var i:int = 0; i < tempArray.length; i ++){ for (var j:int = 0; j < tempArray[i].length; j++){ var Obj:MovieClip ; switch(tempArray[i][j]){ //空白 case 0: continue; case 1: Obj = new wall_1(i,j); hitArr.push(Obj); break; default: Obj = new wall_1(i,j); hitArr.push(Obj); } Obj.addEventListener("destory",ObjectDestory); Obj.x = j*grid; Obj.y = i*grid; addChild(Obj); } } } //删除 private function ObjectDestory(e:Event):void{ } } }