how can I make Accelerate event response immediately ?

I dont want the ball go out side of screen.

this is my code.
but the problem is,when the ball stop at top or bottom, then I try to let it go down(or go up),it will delay for about 1 sec !

anyone tell me why?
thanks a lot !

[lua]local function onAccelerate( event )
dirx=event.xGravity
diry=event.yGravity
end

local function enterframe(event)
if((ball.y<10 and dirx <0) or (ball.y>310 and dirx >0))then
ball:setLinearVelocity( diry*880, 0 )
else
ball:setLinearVelocity( diry*1880, newDirx*1880 )
end
end[/lua]
[import]uid: 21680 topic_id: 12093 reply_id: 312093[/import]