3.5.0-17 0 Newbie Poster

Couldn't find an actionscript section so I hope this is the next best section for such discussion. I'm trying to create an isometric game in adobe builder with AS3 along with the As3IsoLib isometric library. Currently upon clicking a unit you want to move I've got four boxes to popup in four direction either side of the selected unit (where you can move to).

I've added an event listener for all the boxes to call to, passing which box has called it.

      var BOX1:IsoBox = new IsoBox();var BOX2:IsoBox = new IsoBox();
      var BOX3:IsoBox = new IsoBox();var BOX4:IsoBox = new IsoBox();
      var BoxArray:Array = new Array(BOX1,BOX2,BOX3,BOX4);
                                               //Creating boxes and putting them into an array
      var LocArray:Array = new Array(player.x+50,player.y-150/*<NE*/,player.x+150,player.y-50,/*<SE*/player.x+50,player.y+50,/*<SW*/player.x-50,player.y-50/*<NW*/)//start with +50X and -50Y. That will be at same tile as player. Then adjust accordingly.

      var count:int = 0;  

      for each (var occr:IsoBox in BoxArray)

             occr.moveTo(LocArray[count],LocArray[count+1],1); //ADDING +50 to the players X and SUBTRACTING -50 to the players Y gets it to the same tile.

             count = count+2;

             occr.addEventListener(MouseEvent.DOUBLE_CLICK, TileClicked(occr));



function TileClicked(Tile:IsoBox):void

     player.x = Tile.x;
     player.y = Tile.y;


But even though I haven't clicked any of the four boxes the 'TileClicked' function gets executed by the event handeler and it moves the player. I tried adding the event handler when I was defining all the boxes at the very top but the same problem happens.