1 person found this helpful
Why cant you just initialize it with 0, and check for that?
private var _tempIndex:uint = 0;
Thanks for the quick reply, but, that wouldn't work in my situation because i'm actually using that variable as an index for an array collection, so if 0 exists, then it would return true (that the variable has been assigned data). However, I want to dynamically assign data to it based on other conditions. I could create another variable as a string or a boolean and if the variable has been assigned data, then I can set that var to true, and check for that, but that doesn't seem like the most efficient way to go.
A uint always has a value between 0 and 2^32-1 inclusive. It cannot store a "not-set" value like undefined or null. If you declare a variable of type uint without assigning it a value, it is given a default value of 0.
You will either have to keep a separate Boolean flag or use a broader datatype such as Number (which can store NaN), Object (which can store NaN or null), or * (which can store any value, including NaN, null, and undefined).
Adobe Flex SDK Team
Thanks for the info Gordon,
I was wondering why it was returning true (that it had a value of zero) when I didn't assign anything to it. So looks like I will have to create a variable switch to check, thanks again.
I wouldnt use a switch or flag, I would change the datatype. But that's just me!!
I realized the problem was with the datatype (uint) but GordonSmith beat me to it!