Is there a way in flash to check to see if a function/method exists before calling it?

I tried something like if(typeof object.methodname == "function") and it didn't like it.

Thanks!

Ryan