Storyboard API: storyboard.purgeScene( ) error - 'for' limit must be a number

Hi, I have some trouble with using storyboard.purgeScene( )

In my project I have randomly created objects on the background using this code (it’s only part of code for creating objects, excepting _scene:enterScene(e) _and others):

function scene:enterScene(e) local group = self.view; timer.performWithDelay(1500, createBackside, 0) Runtime:addEventListener( "enterFrame", updateBackside) startButton:addEventListener( "tap", onTap) end function createBackside() backside = display.newImageRect ( "backside.png", 73, 56) backside.x = math.floor(math.random() \* 850) backside.y = 0 groupBackside:insert(backside) end function updateBackside() if(groupBackside ~= nil)then for i =1, groupBackside.numChildren do groupBackside[i].y = groupBackside[i].y + speed\*3 groupBackside[i].x = groupBackside[i].x - speed\*4 if (groupBackside[i].y \> \_H) then groupBackside[i]:removeSelf() return end end end end

When I try to call storyboard.purgeScene( ) on the next scene, i get an error: 
 

‘for’ limit must be a number

in line:

for i = 1, groupBackside.numChildren do

Please help me  to solve this problem, because I can’t move on due to this.

I can’t understand correlation between purgeScene() / removeScene() at new scene and this function which simply updates objects at the first scene …

Thank you very much.

What is groupBackside?  Where is it being declared?  Is it a display group that’s being managed by Storyboard?  Is it global? 

Most likely you are never removing the Runtime enterFrame listener that’s calling updateBackside and it’s trying to run after purgeScene or removeScene kills groupBackside.

Rob

What is groupBackside?  Where is it being declared?  Is it a display group that’s being managed by Storyboard?  Is it global? 

Most likely you are never removing the Runtime enterFrame listener that’s calling updateBackside and it’s trying to run after purgeScene or removeScene kills groupBackside.

Rob