obj is cls - it works for me, no compile error (Flex SDK 3).
--- In [email protected], Mark Carter <[EMAIL PROTECTED]> wrote:
>
>
> 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 Sprite();
> > trace(displayObject is DisplayObject);
> > trace(displayObject is Sprite);
> > trace(displayObject is UIComponent);
> >
> > Best regards
> >
> > --- In [email protected], Mark Carter <code@> wrote:
> >>
> >>
> >> 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
what that
> >> means.
> >> --
> >> View this message in context:
> >> http://www.nabble.com/Equivalent-to-Java%27s-
> > Class.isInstance%28Object%29-instance-method--tp20171501p20171501.html
> >> Sent from the FlexCoders mailing list archive at Nabble.com.
> >>
> >
> >
> >
> >
> >
>
> --
> View this message in context:
http://www.nabble.com/Equivalent-to-Java%27s-Class.isInstance%28Object%29-instance-method--tp20171501p20172786.html
> Sent from the FlexCoders mailing list archive at Nabble.com.
>