add event listener after screen finishes loading

I am trying to delay the eventlistener because as the objects enter the screen they are immediately colliding with the target. I need the target to wait until I am ready for it to become the target (of the drag drop event)

Here is what I have

local platform9 = display.newImage("coinslot.jpg")   
platform9.x = display.contentWidth / 2 + 200;   
platform9.y = display.contentHeight -300  
platform9.imageName = "coinslot"  
platform9.myName = "coinslot";  
physics.addBody( platform9, 'static')  
platform9:addEventListener("collision", onCollision)  

but this is what I am trying to do

local function addCoinSlot()  
  
platform9:addEventListener("collision", onCollision)  
  
end  
  
local waitCoinSlot = timer.performWithDelay( 800, addCoinSlot, 1)  

The top code works, the bottom code has a problem getting an assert or something, is there a trick to delaying the listener? [import]uid: 132937 topic_id: 35816 reply_id: 335816[/import]

One method. Use flag.

local coinSlotIsActive = false  
  
local function onCollision(event)  
 if coinSlotIsActive then -- true  
  
 ---your collision events here  
 end  
end  
  
local platform9 = display.newImage("coinslot.jpg")   
platform9.x = display.contentWidth / 2 + 200;   
platform9.y = display.contentHeight -300  
platform9.imageName = "coinslot"  
platform9.myName = "coinslot";  
physics.addBody( platform9, 'static')  
platform9:addEventListener("collision", onCollision)  
  
local function addCoinSlot()   
 -- Set coinSlotIsActive = true  
 coinSlotIsActive = true  
end  
   
local waitCoinSlot = timer.performWithDelay( 800, addCoinSlot, 1)  
  

burhan [import]uid: 74883 topic_id: 35816 reply_id: 142454[/import]

One method. Use flag.

local coinSlotIsActive = false  
  
local function onCollision(event)  
 if coinSlotIsActive then -- true  
  
 ---your collision events here  
 end  
end  
  
local platform9 = display.newImage("coinslot.jpg")   
platform9.x = display.contentWidth / 2 + 200;   
platform9.y = display.contentHeight -300  
platform9.imageName = "coinslot"  
platform9.myName = "coinslot";  
physics.addBody( platform9, 'static')  
platform9:addEventListener("collision", onCollision)  
  
local function addCoinSlot()   
 -- Set coinSlotIsActive = true  
 coinSlotIsActive = true  
end  
   
local waitCoinSlot = timer.performWithDelay( 800, addCoinSlot, 1)  
  

burhan [import]uid: 74883 topic_id: 35816 reply_id: 142454[/import]