Very clever! I didn't know that. Gordon Smith Adobe Flex SDK Team ________________________________
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Shaw Sent: Monday, February 18, 2008 7:04 PM To: [email protected] Subject: Re: [flexcoders] Re: Example of Object.isPrototypeOf () Actually I believe I have a real use case for isPrototypeOf(). Suppose you want to determine if classB is derived from classA without instantiating anything. if (classA.prototype.isPrototypeOf(classB.prototype)) { trace("yes!"); } -A On Feb 15, 2008 6:57 PM, Gordon Smith <[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> > wrote: It's definitely not a dumb question, but it is fairly irrelevant. You probably don't need to understand prototype chains to be a good Flex programmer. I can't find a single place in any of our Flex components that we call isPrototypeOf(), so its unlikely that you need to call it either. (That said, we do use prototype chains to implement fast CSS style lookup with getStyle().) If you're curious about prototype-based inheritance, see http://en.wikipedia.org/wiki/Prototype-based_programming <http://en.wikipedia.org/wiki/Prototype-based_programming> . Gordon Smith Adobe Flex SDK Team ________________________________ From: [email protected] <mailto:[email protected]> [mailto:[email protected] <mailto:[email protected]> ] On Behalf Of Roscoe P Coltrane Sent: Friday, February 15, 2008 10:04 AM To: [email protected] <mailto:[email protected]> Subject: [flexcoders] Re: Example of Object.isPrototypeOf () What exactly does it mean when the Flex doco says: "This method returns true if the object is in the prototype chain of the object specified by the the Class parameter." What does "prototype chain" mean here? Sorry for my ignorance if this is a dumb question. And are you saying this is an obsolete method? --- In [email protected] <mailto:flexcoders%40yahoogroups.com> , "Gordon Smith" <[EMAIL PROTECTED]> wrote: > > Flex makes almost no use of AS3's old-style prototype-based inheritance; > it uses the new class-based inheritance. If by "descendant" you mean > "instance of", use the 'is' operator: > > var b:Button = new Button(); > trace(b is UIComponent); // --> true > > Gordon Smith > Adobe Flex SDK Team > > ________________________________ > > From: [email protected] <mailto:flexcoders%40yahoogroups.com> [mailto:[email protected] <mailto:flexcoders%40yahoogroups.com> ] On > Behalf Of Roscoe P Coltrane > Sent: Thursday, February 14, 2008 6:15 AM > To: [email protected] <mailto:flexcoders%40yahoogroups.com> > Subject: [flexcoders] Example of Object.isPrototypeOf () > > > > Could someone give me a working or semi-working example of how/when to > use isPrototypeOf()? I was thinking that I could query an object and > if it was a descendent of another object, [the argument to > isPrototypeOf()], the method would return true. Not so :) Obviously I > don't understand the usage of this method. > > Thanks, > Roscoe >

