Was just wondering how to remove an object from memory if it was created in a function.
If I had an image called ‘background1’ that I’d created in a function, for example called ‘createBackground1’, later on I would want to remove that image from memory but if I use removeSelf() it doesn’t work.
define the variable as local outside the function then you’ll be able to reference it and remove it later on [import]uid: 9371 topic_id: 4081 reply_id: 12593[/import]
Then had a function that set up the
Image saying that background1 is background1.png
And later on I had a function that made background1 remove self it would work?
What if I wanted to redraw background1 later on, wouldn’t it be removed, so couldn’t be re-drawn?
Thanks again
Ace [import]uid: 9899 topic_id: 4081 reply_id: 12595[/import]
Right, my plan now is to Pre-load ‘background’ and when the user goes into another room it just changes background from ‘background1.png’ to ‘background2.png’ etc.
My only problem now is the interactive objects on each level. If I had all the elements built into the background image I’d just need to create some squares with the alpha set to 0 over the objects. How could I add and remove these determining what level we’re on?
If the invisible touch areas don’t take up much memory I could keep them hidden off screen but I’m sure there’s a lot better way to do this just need help with how
Cheers n that
Ace [import]uid: 9899 topic_id: 4081 reply_id: 13073[/import]