Not sure what categoriesTree is or what CategoryTree is.  ObjectUtil.copy 
doesn't work on DisplayObjects.  You may also need to use registerClassAlias.

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of 
fotis.chatzinikos
Sent: Tuesday, November 11, 2008 11:14 AM
To: [email protected]
Subject: [flexcoders] bug or feature (or am i doing something wrong)?


Hi,

I am using ObjectUtil.copy to deep copy an object.

The following code works: (note the call to new)

var catTreeLocalToFiltered:CategoryTree = new CategoryTree() ;

catTreeLocalToFiltered = ObjectUtil.copy(categoriesTree) as CategoryTree ;

The problem is that the following code DOES NOT WORK:(note the absense
of new)

var catTreeLocalToFiltered:CategoryTree =
ObjectUtil.copy(categoriesTree) as CategoryTree ;

Actually it semi works. The first time catTreeLocalToFiltered is the
same as categoriesTree.

The second time catTreeLocalToFiltered does not become equal to
categoriesTree but becomes equal to itself as it was after the first call.

Are bytes cached for local variables if new is not explicitly used?

Anybody from Adobe?

PS: All this was checked/found out in the debugger stepping throught
the code line by line...

Thanks,
Fotis

Reply via email to