Yeah, I do things like that all the time in framework code, that's what you
need.

-Josh

On Mon, Oct 27, 2008 at 3:50 PM, andrii_olefirenko <[EMAIL PROTECTED]>wrote:

> 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.
> >
>
>
>
> ------------------------------------
>
> --
> Flexcoders Mailing List
> FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
> Alternative FAQ location:
> https://share.acrobat.com/adc/document.do?docid=942dbdc8-e469-446f-b4cf-1e62079f6847
> Search Archives:
> http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! Groups
> Links
>
>
>
>


-- 
"Therefore, send not to know For whom the bell tolls. It tolls for thee."

Like the cut of my jib? Check out my Flex blog!

:: Josh 'G-Funk' McDonald
:: 0437 221 380 :: [EMAIL PROTECTED]
:: http://flex.joshmcdonald.info/

Reply via email to