It seems that the constants behave strangely in Flex.
Here is why:
public const X:String = "X"; public const Y:int = 101; public const NotSoConstant:XML = ...some random xml...
Now here comes the fun part:
var x:string = X; x = "aaa"; trace(X + ":" + x); // X:aaa var y:int = Y; y = 10; trace(Y +":" + y); //101:10 var constantOrNot:XML = NotSoConstant; constantOrNot = ...another xml...
Now you would think that constantOrNot will be different from NotSoConstant? You would be wrong. It seems that in the cases of XML objects the initial setup of the constantOrNot is done by using a reference pointer. So if you modify the constantOrNot it will also modify the constant it was used to set it up.
Popularity: 21%
Tags: bug, constant, flex, xml
This post was written by Virgil Cristea
Views: 425


















