3 Replies Latest reply on May 12, 2006 12:53 PM by JustStartingOut

    undefining variables

    radarguy1 Level 1
      I am trying to make a reset button that will clear a set of variables and text boxes. The variables define coordinates that draw lines. When I think everything is reset and select new variables the last one is either zero, zero or null, null. The only way I can think of to eliminate this is to restart the movie. So her is the question: Is there either a way to undefine variable or to have a move restart itself from a button?
        • 1. Re: undefining variables
          Level 7
          radarguy1,

          > I am trying to make a reset button that will clear a set of
          > variables and text boxes.

          I guess you're talking about the Var field in the Property inspector for
          each text field, right? Personally, I would go with the TextField.text
          property of each text field. To me, that makes more sense than linking text
          fields to a variable. Not saying it's wrong -- there's nothing wrong with
          what you're doing (assuming I've even guessed right!) -- but ehh, for what
          it's worth, that's my tiny soapbox.

          > The variables define coordinates that draw lines. When I think
          > everything is reset and select new variables the last one is either
          > zero, zero or null, null.

          What if you set those variables to empty strings?

          > So her is the question: Is there either a way to undefine variable
          > or to have a move restart itself from a button?

          You can delete variables (see the delete entry of the ActionScript
          Language Reference), but that might just set their values back to null.
          Worth a shot, though.


          David
          stiller (at) quip (dot) net
          Dev essays: http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: undefining variables
            .:}x-=V!P=-x{:. Level 3
            delete variableName;
            • 3. Re: undefining variables
              JustStartingOut
              And if not the delete command, maybe setting the value to undefined:
              on(release)
              { _root.myVarName = undefined; }