*sigh* How stupid am I - someone has just pointed out that the
built-in Object.hasOwnProperty() does this perfectly well. :-)

So try:

if (currentSection.hasOwnProperty('refresh'))
{
       currentSection['refresh']();
}

That'll teach me not to read every line of the docs. ;-)

Ian

On Tue, Oct 28, 2008 at 2:13 PM, Karim Beyrouti <[EMAIL PROTECTED]> wrote:
> This is great - thank you....
>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ian Thomas
> Sent: 28 October 2008 08:46
> To: Flash Coders List
> Subject: Re: [Flashcoders] AS3 - Checking if a Function Exists
>
> Method:
>
>    public static function refExists(obj:Object,name:String):Boolean
>    {
>        try
>        {
>            if (obj[name]!=null)
>                return true;
>        }
>        catch (e:ReferenceError) {}
>        return false;
>    }
>
> HTH,
>   Ian
>
> On Tue, Oct 28, 2008 at 8:36 AM, Ian Thomas <[EMAIL PROTECTED]> wrote:
>> Or, thinking about it, you could catch the reference error in a
>> try/catch block. It's more of a kludge, but might give you much higher
>> performance!
>>
>> Ian
>>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> _______________________________________________
> Flashcoders mailing list
> [email protected]
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to