In the following class
A break point on the "Okay" line shows that x1 is null but x2 is equal to "<entity id="DRONE" points="100"/>".Code:package { public class Factory { public static var myXML:XML; public function Factory() { } public static function staticTest(varName:String) { switch(varName) { default: Factory.myXML = <entitydefaults> <entity id='DRONE' points='100'></entity> <entity id='BOMBER' points='1000'> </entity> </entitydefaults> var x1 = Factory.myXML.entity.(@id == 'DRONE'); var x2 = Factory.myXML.entity.(@id == 'DRONE'); trace('okay'); } } } }
If I take the whole block out of the switch statement, both x1 and x2 are equal to the expected xml.
Why?




Reply With Quote
