parallax simplified - where to put 'the cleanup' in the director class

Hi

I tried to implement a parallax scroll according to this tutorial --> http://www.coronalabs.com/blog/2012/10/16/parallax-simplified/#comment-7858

unfortunately its not working because somewhere in the director should be the follwing cleanup:
for i=#stage.paraGroups,1,-1 do
stage.paraGroups[i] = nil
end
stage:removeEventListener( “touch”, touchScreen )
I have no idea where to put this cleanup.
Any help much appreciated! [import]uid: 145756 topic_id: 32981 reply_id: 332981[/import]

Put it within the function you call when ending the game/changing the scene, presumably? If you show current code and how/when you’re ending the level someone should be able to assist you :slight_smile: [import]uid: 52491 topic_id: 32981 reply_id: 130978[/import]

Put it within the function you call when ending the game/changing the scene, presumably? If you show current code and how/when you’re ending the level someone should be able to assist you :slight_smile: [import]uid: 52491 topic_id: 32981 reply_id: 130978[/import]

When I put it within the function changing scene in director.lua I get the error:

attempt to index global ‘stage’ (a nil value) [import]uid: 145756 topic_id: 32981 reply_id: 131070[/import]

When I put it within the function changing scene in director.lua I get the error:

attempt to index global ‘stage’ (a nil value) [import]uid: 145756 topic_id: 32981 reply_id: 131070[/import]