Re: [flexcoders] Equivalent to Java's Class.isInstance(Object) instance method?

2008-10-27 Thread Mark Carter
Oops, sorry. Thanks, you're right! FlexBuilder code completion wasn't giving me the chance to put a variable after is - so I just assumed it wasn't possible (like in Java). andrii_olefirenko wrote: obj is cls - it works for me, no compile error (Flex SDK 3). -- View this message in

Re: [flexcoders] Equivalent to Java's Class.isInstance(Object) instance method?

2008-10-27 Thread Josh McDonald
Yeah, builder's not so smart when you're trying to do anything out of the ordinary :) On Mon, Oct 27, 2008 at 4:01 PM, Mark Carter [EMAIL PROTECTED] wrote: Oops, sorry. Thanks, you're right! FlexBuilder code completion wasn't giving me the chance to put a variable after is - so I just

Re: Re: [flexcoders] Equivalent to Java's Class.isInstance(Object) instance method?

2008-10-27 Thread Mark Carter
Hi Mike - sorry, you've lost me there... The few tests I've done show that obj is cls is what I need. Are you saying that does not work? Michael Schmalle wrote: Adding to the insight, if you wanted to use the 'is' operator with those two arguments, you need to create an instance of the

Re: [flexcoders] Equivalent to Java's Class.isInstance(Object) instance method?

2008-10-27 Thread Eric Cooper
The question has been answered (yes, it is possible to use is as part of isInstanceOf() method. Here's an example of my use of this mechanism (for determining if geometric shapes share an instance of a particular class of constraint, e.g. are these two line segments perpendicular to each

Re: [flexcoders] Equivalent to Java's Class.isInstance(Object) instance method?

2008-10-27 Thread Michael Schmalle
I messed up, what I said does not work, to early in the morning for me. :) 'is' tests an instance to a class reference. I was thinking in the opposite direction when I gave that example. Eric shows you. Mike On Mon, Oct 27, 2008 at 11:41 AM, Eric Cooper [EMAIL PROTECTED] wrote: The question

[flexcoders] Equivalent to Java's Class.isInstance(Object) instance method?

2008-10-26 Thread Mark Carter
I've got an array of objects which I want to filter according to the object's class. The class itself is referenced by a variable so I cannot use the is operator. I'd like to be able to do something like: filterClass.isInstance(obj) Do I need to use isPrototypeOf()? - I don't really understand

Re: [flexcoders] Equivalent to Java's Class.isInstance(Object) instance method?

2008-10-26 Thread Mark Carter
I don't think that works when I have a variable of Class type. public static function isObjectInstanceOfClass(obj:Object, cls:Class):Boolean { return obj is cls; // compile error } florian.salihovic wrote: You are searching for the is-operator: var displayObject:DisplayObject = new