Hi, That's actually not how AS words either. "new ObjectOne()" creates an instance of ObjectOne in memory, which you then assign by reference to object1. After that you assign the same object instance by reference to object2. That just means both objects point to the same object. Assigning "null" to object2 does not in fact destroy the object or set it null, it only changes the place in memory *referenced* by object2, object1 will still point to the same instance. Only when you explicitly state "object1 = null" and as such remove any references to the ObjectOne instance, can it be garbage collected and removed from memory. ActionScript also does not allow any different behaviour in that part of the player, so Away3D can only handle it the same way as AS does it.
Hope that helps! David On Wed, Oct 21, 2009 at 11:10 AM, SasMaster <[email protected]> wrote: > > Hi, I have a strange problem . I have an object that extends > ObjectContainer3D . in one function I am assigning it's > reference to another object of the same kind. Then is the spooky part: > When I make the referenced instance > =null , the initial referenced Object still resides in memory . Is the > passing by reference is different in Away3d. i know for sure that in > Any ActionScript Class the following is always true: > > var object1:ObjetOne=new ObjectOne(); > var object2:ObjectOne= object1 as ObjectOne; > > object2=null; > > trace(object1); and you will get NULL !!! So is this different for > Away? > > Thanks -- http://www.derschmale.com
