I have a button that when “tapped”, I want to apply an LinearImpuse(upwards on the yAXIS)
to another object called “ball”
When I issue the appliLinearImpulse from within the function button:tap( event)
I get a null error call at this line of code, “ball:applyLinearImpuse(0,-0.2,ball.x,ball.y)”
Guess i need to know how to “pass” that object into that function “button” from the TAP event ?
I tried including the {ball} inside the function call button Argument/Parameter list.
Example, button:addEventListener(“tap”, button, {ball})
But it did not work. 
Any help would be appreciated.
Thanks
Here is the code…
local physics = require( “physics” )
physics.setDrawMode( “normal” ) – the default Corona renderer, with no collision outline
physics.setPositionIterations(9)
local lid = display.newImage( “top.png” )
lid.x = 125; lid.y = -31
physics.addBody( lid, “static”, { friction=0.0001, bounce=0.2 } )
local ground = display.newImage( “ground.png” )
ground.x = 190; ground.y = 511
physics.addBody( ground, “static”, { friction=0.0001, bounce=0.2 } )
local r_side = display.newImage( “container.png” )
r_side.x = -65 ; r_side.y = 295
physics.addBody( r_side, “static”, { friction=0.5, bounce=0.2 } )
local l_side = display.newImage( “container2.png” )
l_side.x = 385 ; l_side.y = 295
physics.addBody( l_side, “static”, { friction=0.5, bounce=0.2 } )
local ball = display.newImage( “ball.png” )
ball.x = 175; ball.y = 0; ball.rotation = 0
physics.addBody( ball, { density=99, friction=25.5, bounce=.4 } )
local button = display.newImage(“button.png”)
button.x = display.contentWidth/2
button.y = display.contentHeight - 50
function button:tap( event)
ball:applyLinearImpuse(0,-0.2,crate.x,crate.y)
return true
end
button:addEventListener(“tap”, button)
[import]uid: 11094 topic_id: 15340 reply_id: 315340[/import]
[import]uid: 11094 topic_id: 15340 reply_id: 56779[/import]