Skip navigation
Currently Being Moderated

how to check if a function exists in Flex?

Aug 18, 2012 2:12 AM

Hi,

 

I am wondering if there is any method to check if a function exists in Actionscript/Flex.

The same way as we do isdefined in javascript.

 

 

Thank you

Mayank

 
Replies
  • Currently Being Moderated
    Aug 19, 2012 9:32 AM   in reply to mayanks20

    On instances - use Object hasOwnProperty method - all objects in AS3 inherit from Object:

     

    var mc:MovieClip = new MovieClip();

    var s:Sprite = new Sprite();

       

    trace(mc.hasOwnProperty("play")); // true

    trace(s.hasOwnProperty("play")); // false

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points