2 Replies Latest reply on Mar 14, 2007 4:15 AM by Newsgroup_User

    does a variable exist?

    DZ-015 Level 1
      So... I've got an object, and I want to know if there is a variable inside the object named "thing"

      like so:
      objectInstance.thing

      Is there a way I can test to see if "thing" exists? (regardless of thing's data type or content)

      thanks
        • 1. Re: does a variable exist?
          kglad Adobe Community Professional & MVP
          :

          • 2. Re: does a variable exist?
            Level 7
            objectInstance.thing == undefined ? trace ("objectInstance.thing is
            undefined") : trace ("objectInstance.thing = "+objectInstance.thing);

            Look out for line wrapping - the above is all one line. It's a shorthand way
            of expressing:

            if (objectInstance.thing == undefined){
            trace ("objectInstance.thing is undefined);
            } else{
            trace ("objectInstance.thing = "+objectInstance.thing);
            }



            --
            -------------------------------
            Remove '_spamkiller_' to mail
            -------------------------------