Rotating/Spinning Object Error

I’ve been using the “gear rotation” code from the learning corona website and I’ve come across an error. When I try to move to my next level I get this error: attempt to perform arithmetic on field ‘rotation’ (a nil value). This is what my code looks like.

local function animate ( event )
object.rotation = object.rotation + 7
end
Runtime:addEventListener( “enterFrame”, animate)

It work perfectly other than not allowing me to move to the next level.

Any ideas? [import]uid: 46082 topic_id: 12613 reply_id: 312613[/import]

Are you using the director to change levels? If so, where you declare director:changeScene add this, let me know if it worked.
[lua]Runtime:removeEventListener( “enterFrame”, animate) [import]uid: 17138 topic_id: 12613 reply_id: 46169[/import]