Jeremy Sachs wrote:
Hmm... what do you mean here by configurator, Cryzto?

Well my plan was to fill up the array with object's-name that are visible in
the configurator (active ones)...

Remember that some objects have name as a property- it's a String. If by "name" you mean the "name" of the reference you're using when you're referring to an object, then you mean the "definition".

See, every data type in Flash is an object, and the variables you're creating are all just references to the objects. By assigning a new Array object to my_array, you're automatically deleting the reference to the old Array (so the line where you delete my_array isn't actually necessary). If that was the only reference to it, it'll be cleaned up by the GC.

I believe that Arrays and other simple data types are deallocated almost immediately. More complicated objects tend to take a little longer. There's a lot of info out there regarding the GC, but what it comes down to is, you never know exactly when the GC will run, or whether it'll remove all your garbage. It's a leap of faith. But you can help the GC operate faster by removing all the references to the objects you want to delete. For instance, if you write:

var a:Array = new Array();
var b:Array = a, c:Array = b, d:Array = c;

...then you've got four references to the same Array object. That Array won't be deallocated until each reference is deleted or set to equal null.


Sorry, but I don't know which assignement you exactly refer to, do you mean
" my_array.push(z)=z; "?

Yes, push() is a method of Array objects that takes a value passed to it and adds an element with that value to the very end of the array. You don't need the "=z", which, well, doesn't make much sense in the first place. :D

I hope that helps. Regards,

Rezmason
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

To Rezmason: The simple data types are called primitives. These include Numbers, ints, uints, Strings. Complex data types include everything else (Objects, Arrays etc.)
Primitives are cleaned up immediately (using the delete keyword or null)

For more information you can find a great article on Garbage Collection (GC) and Resource Management here:
http://www.gskinner.com/talks/resource-management/

Cheers,
Nick
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to