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 flexcoders@yahoogroups.com, "Paul Whitelock" <[EMAIL PROTECTED]> 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])[EMAIL PROTECTED](); > 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 flexcoders@yahoogroups.com, "Alex Harui" <aharui@> wrote: > > > > There is code that might help in > > DataGrid.as:itemEditorItemEditEndHandler > > > > ________________________________ > > > > From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On > > Behalf Of Paul Whitelock > > Sent: Thursday, May 15, 2008 12:31 PM > > To: flexcoders@yahoogroups.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? > > >