Are you sure there’s a display object assigned to layerMain[1].obj ?
You can do this:
[blockcode]
if layerMain[1].obj.removeSelf then
layerMain[1].obj.removeSelf()
layerMain[1].obj = nil
end
[/blockcode]
That should take care of the error. You can also do a for loop and iterate through all the keys of layerMain to do that check and call removeSelf() on everything that has that method available (display objects).
Hope that helps! [import]uid: 52430 topic_id: 8923 reply_id: 32586[/import]