Wednesday, June 23, 2010

FLEX / Action Script XML Datatype Initialize issues.

I recently found an issue with XML DataType in Flex / Action Script ( 4 / 3 respectively).
I was trying to re-Initialize an XML variable using another XML variable as follow.


public var newTreeData:XML = ;
public var newTreeDataReset:XML = ;

......(***Changes 1) Do some changes to "newTreeData" ..............

newTreeData = newTreeDataReset;

......(***Changes 2) Do some more changes to "newTreeData" ..............

After this, i was expecting that "newTreeData" will contain the changes made in the code "***Changes 2" and the variable "newTreeDataReset" will still contain the initial value .

But i was wrong to expect that.... the changes made in the code "***Changes 2" were applied to both "newTreeData" and "newTreeDataReset".

I know this should not happen from a programming language/OO programming point of view but this does happen.....
I don't know if this a bug or if it is the intended behavior.

Hope this helps some one understand why the xml variable act strangely some times.


No comments:

Post a Comment