Alrighty then, I filed a bug report since the following outputs "int":
var uintVar:uint = 5; trace(describeType(uintVar)[EMAIL PROTECTED]()); --- In [email protected], "Gordon Smith" <[EMAIL PROTECTED]> wrote: > > I think there is a conceptual distinction between the runtime type of an > AS3 value and the compile-time type of a var or parameter that holds > such a value. > > > > The 'is' operator works on values. A value like 5 'is' both an int, a > uint, and a Number because it is a legal value in the set of possible > values for each of these types. > > > > But I would expect a var declared as > > > > var u:uint; > > > > to report itself via describeType() as a uint, just like int and Number > do. It seems like a bug that it doesn't. > > > > Gordon Smith > > Adobe Flex SDK Team > > > > ________________________________ > > From: [email protected] [mailto:[EMAIL PROTECTED] On > Behalf Of Paul Whitelock > Sent: Thursday, May 15, 2008 3:59 PM > To: [email protected] > Subject: [flexcoders] Re: How to tell if variable is an int, uint, or a > Number? > > > > Thanks for the suggestion, but it still considers an int to be a uint > if the int is positive. > > --- In [email protected] <mailto:flexcoders%40yahoogroups.com> > , Sherif Abdou <sherif626@> wrote: > > > > try using a dictionary instead of object > > > > > > ----- Original Message ---- > > From: Paul Whitelock <paul@> > > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > > Sent: Thursday, May 15, 2008 4:11:19 PM > > Subject: [flexcoders] Re: How to tell if variable is an int, uint, > or a Number? > > > > > > Well, it turns out that doesn't work either if the int is positive. If > > an int is positive all of the follow tests return true: > > > > var testInt:int = 5; > > var obj:Object = testInt; > > > > obj is int -> true > > obj is uint -> true > > obj is Number -> true > > > > Sooooo, I'm back to assuming there is no way to tell an int from a > uint. > > > > > > --- In [EMAIL PROTECTED] ups.com, "Paul Whitelock" <paul@> wrote: > > > > > > I found another way that seems to work (not sure why though): > > > > > > var testUint:uint = 1; > > > var testInt:int = -1; > > > var testNumber:Number = 1.1; > > > > > > var obj:Object = testUint; > > > > > > trace ("uint: " + (obj is uint && obj is int)); > > > trace ("int: " + (obj is int && !(obj is uint))); > > > trace ("Number: " + ((obj is Number) && !(obj is int) && !(obj is > > uint))); > > > > > > Output: > > > uint: true > > > int: false > > > Number: false > > > > > > obj = testInt; > > > > > > trace ("uint: " + (obj is uint && obj is int)); > > > trace ("int: " + (obj is int && !(obj is uint))); > > > trace ("Number: " + ((obj is Number) && !(obj is int) && !(obj is > > uint))); > > > > > > Output: > > > > > > uint: false > > > int: true > > > Number: false > > > > > > obj = testNumber; > > > > > > trace ("uint: " + (obj is uint && obj is int)); > > > trace ("int: " + (obj is int && !(obj is uint))); > > > trace ("Number: " + ((obj is Number) && !(obj is int) && !(obj is > > uint))); > > > > > > Output: > > > uint: false > > > int: false > > > Number: true > > > > > > > > > --- In [EMAIL PROTECTED] ups.com, "Paul Whitelock" <paul@> wrote: > > > > > > > > Thanks! That did help, but it doesn't seem to work for a uint. > Here's > > > > my test code: > > > > > > > > var testUint:uint = 1; > > > > var testInt:int = -1; > > > > var testNumber:Number = 1.1; > > > > var testString:String = "test"; > > > > var testDate:Date = new Date(); > > > > var testArray:Array = new Array(); > > > > > > > > var test:Array = [testUint, testInt, testNumber, testString, > testDate, > > > > testArray]; > > > > > > > > for (var i:uint = 0; i < test.length; i++) { > > > > var typeInfo:String = describeType( test[i]). @name.toString( ); > > > > trace(typeInfo) ; > > > > } > > > > > > > > And here's the output: > > > > > > > > int > > > > int > > > > Number > > > > String > > > > Date > > > > Array > > > > > > > > I'm guessing there's no way to identify a uint -- is that correct? > > > > > > > > > > > > --- In [EMAIL PROTECTED] ups.com, "Alex Harui" <aharui@> wrote: > > > > > > > > > > There is code that might help in > > > > > DataGrid.as: itemEditorItemEd itEndHandler > > > > > > > > > > ____________ _________ _________ __ > > > > > > > > > > From: [EMAIL PROTECTED] ups.com > > > [mailto:[EMAIL PROTECTED] ups.com] On > > > > > Behalf Of Paul Whitelock > > > > > Sent: Thursday, May 15, 2008 12:31 PM > > > > > To: [EMAIL PROTECTED] ups.com > > > > > Subject: [flexcoders] How to tell if variable is an int, uint, > or a > > > > > Number? > > > > > > > > > > > > > > > > > > > > I have a situation where an untyped variable is passed in a > method > > > > > call and I need to determine the data type for the variable. My > > first > > > > > thought was to use typeof, but typeof returns "number" for an > int, > > > > > uint, or a Number. The operator "is" will not work on > primitives. > > > > > > > > > > Is there any way to determine the data type of an untyped > primitive > > > > > object? > > > > > > > > > > > > > > >

