Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Adobe AIR Development

Reply
Contributor
tylorpin
Posts: 39
Registered: ‎06-13-2011
My Carrier: digi
Accepted Solution

Do I need to removeChild() after I've destroyed the variable?

Hi there, inside my app there will be one button which when pressed, it'll "reset" the whole app and start over again.

 

Now I have 2 questions.

 

The first one is, if i wanna completely destroy a variable and clear up the cache, I use =null; for all the variable right?

 

The second is, after I've destroyed an image variable. Do i still need to use removeChild() to remove it?

Please use plain text.
Developer
vjkmr
Posts: 78
Registered: ‎05-17-2012
My Carrier: Reliance

Re: Do I need to removeChild() after I've destroyed the variable?

Hi

If you set null to variable, the variable does contain any values to get and if it object, you may need to create the memory for it again. Once after you set null to image variable, you need not to use removeChild().
Please use plain text.
Developer
jtegen
Posts: 6,536
Registered: ‎10-27-2010
My Carrier: Verizon

Re: Do I need to removeChild() after I've destroyed the variable?

addChild and removeChild adds and removes objects from the display list. removeChild, does not delete the object, it just removes it from the display list. It is probably cleaner to remove it from the display list and then setting it to null, so that the display list is not looping over something that does not exist. Not required, but cleaner.
Please use plain text.
Contributor
tylorpin
Posts: 39
Registered: ‎06-13-2011
My Carrier: digi

Re: Do I need to removeChild() after I've destroyed the variable?

yeap that's what i get also. My apps although i've set it all to null, it still runs a bit laggy. after i removeChild and set it all to null, the whole thing runs perfectly as it is the first time.

Please use plain text.