I think this may be another way... if (obj.hasOwnProperty("getChildren")) children = obj.getChildren(); - Gordon
________________________________ From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On Behalf Of dordea cosmin Sent: Tuesday, April 03, 2007 12:13 PM To: flexcoders@yahoogroups.com Subject: Re: [flexcoders] getChildren only objects that inherit the Container class have this functions. When i have a situation like yours, I usually do something like : if ( obj is Container) { //code here } and it works fine. It is possible not to work if your object was originally an Object , and you further created your object using a class reference. ----- Original Message ---- From: Michael Schmalle <[EMAIL PROTECTED]> To: flexcoders@yahoogroups.com Sent: Tuesday, April 3, 2007 11:51:48 AM Subject: Re: [flexcoders] getChildren Hi, You could do this; try { children = obj.getChildren( ); } catch (e:Error) { trace(e, "obj did not have getChildren( )"); } Peace, Mike On 03 Apr 2007 11:41:25 -0700, blc187 <[EMAIL PROTECTED] com <mailto:[EMAIL PROTECTED]> > wrote: is there a way to tell if an object has a getChildren method before calling it? I'm calling something that takes any type as the first argument public function myFunc(obj:* ):void I need to tell if obj has a getChildren( ) method before I call it and get an error saying Error #1006: getChildren is not a function. -- Teoti Graphix http://www.teotigra phix.com <http://www.teotigraphix.com> Blog - Flex2Components http://www.flex2com ponents.com <http://www.flex2components.com> You can find more by solving the problem then by 'asking the question'. ________________________________ Get your own web address. <http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domain s/?p=BESTDEAL> Have a HUGE year through Yahoo! Small Business. <http://us.rd.yahoo.com/evt=49678/*http://smallbusiness.yahoo.com/domain s/?p=BESTDEAL>