Skip to main content
Participant
May 12, 2006
Question

undefining variables

  • May 12, 2006
  • 3 replies
  • 312 views
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?
This topic has been closed for replies.

3 replies

Participating Frequently
May 12, 2006
And if not the delete command, maybe setting the value to undefined:
on(release)
{ _root.myVarName = undefined; }
Participating Frequently
May 12, 2006
delete variableName;
Inspiring
May 12, 2006
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."