title: touchEvent for Grid(2D-Array)of Sprites using Corona sdk
body: <p>I have a grid of animated sprites in an 2D-Array, but when put the eventListener for a sprite object it is showing the following error "Director ERROR: Failed to load module 'game' - Please check if the file exists and it is correct.", when I remove the code for touch the next scene pops up with animated fireballs in a grid(which is nice), but I wanted to implement touchevents for the individual sprites in the grid. Please help me. Thanks</p>
  
  <p>Here Is the Code:</p>
  
  <p>module(..., package.seeall)
  function new()</p>
  
  <pre><code>local localGroup = display.newGroup()
  
  local gamebg=display.newImageRect("gameBG.png",_W,_H)
  gamebg:setReferencePoint(display.centerReferencePoint)
  gamebg.x=_W/2
  gamebg.y=_H/2
  swapButton = {} --A 2D Array
  local instance = {}
  
  require "sprite"
  
  
  local tempX=130
  local tempY=60
  
  for i = 0, 6, 1 do
      swapButton[i]={}
      instance[i]={}
  
      for j=0,6,1 do      
          instance[i][j]=sprite.newSprite(sprite.newSpriteSet(sprite.newSpriteSheet("fireBall.png",36,36),1,40))
          instance[i][j].x=tempX
          instance[i][j].y=tempY
          instance[i][j]:prepare()
          instance[i][j]:play()
  
          instance[i][j]:addEventListener("touch",myTouchListener)
          swapButton[i][j]= display.newImage("circle.png",40,40)
          swapButton[i][j].x=tempX
          swapButton[i][j].y=tempY
          tempX=tempX+40
  
  
      end
      tempX=130
      tempY=tempY+40
  end
  
  function myTouchListener:touch(event)
  if event.phase == "began" then
      display.getCurrentStage( ):setFocus( event.target );
      print(display.getCurrentStage( ))
   elseif event.phase=="moved" then
   print("moved")   
  elseif event.phase == "ended" then
      display.getCurrentStage( ):setFocus( nil );
  end
  
  
  
  localGroup:insert(gamebg)
  
  
  return localGroup
  </code></pre>
  
  <p>end</p>
  
  <p>thanks</p>
  
  <p>-Hemanth </p>