How do I name this so I can remove it?

I want to name this so I can remove it in the exitScene

 

<code>

 

letterHolder = {} 

numOfImages = 10

 

for i=1,numOfImages do

   letterHolder[i] = display.newImageRect(“topBlock.png”, 20, 20) 

   letterHolder[i].x = math.random(0, display.contentWidth) 

   letterHolder[i].y = math.random(0, display.contentHeight) 

end

 

<code>

Well if letterHolder is scoped so that exitScene() can see it, you would just do:

for i = numOfImages, 1, -1 do

     display.remove(letterHolder[i])

     letterHolder[i] = nil

end

Though if you insert these into your scene’s “group”, then storyboard will take care of cleaning them up for you.

Rob

Thanks! I know this is a simple thing that I will know for the rest of my existence but thank you. Finally something is working even though it is so small it brings me happiness. Thanks.

oh also how would I add this to my Parallax scrolling function?

Well if letterHolder is scoped so that exitScene() can see it, you would just do:

for i = numOfImages, 1, -1 do

     display.remove(letterHolder[i])

     letterHolder[i] = nil

end

Though if you insert these into your scene’s “group”, then storyboard will take care of cleaning them up for you.

Rob

Thanks! I know this is a simple thing that I will know for the rest of my existence but thank you. Finally something is working even though it is so small it brings me happiness. Thanks.

oh also how would I add this to my Parallax scrolling function?