PDA

View Full Version : delete input texfield variable?


Rupert
06-11-2003, 08:21 AM
I'm posting this in "Simple stuff" cause I'm hoping it is simple - oh don't you love the positive attitude people!!

I'm building a kids interactive "thingy" (noun, singular) it has a bunch of functions in the first frame and then about 40 frames on which each one has a text question and an input text box called...."inputTextBox" - how original. You type in your answer and if you are right it sends you to the next frame, if not it calls you horrible things and makes you feel inadequate.

My problem is this - I am using the same dynamic input text box variable name in each of the following 40+ frames because i'm checking its value with stuff that was loaded on the first frame - so to give each text box a unique name would be impractical in this case. The first value typed into the first instance of inputTextBox seems to get stuck in memory somehow and even when I redeclare its value as inputTextBox = null; or inputTextBox = ""; the second and subsequent instances of the textbox continue to want the first value that was input.

Is there a way to continue to use the same input text box names and maybe clear the value from the variable somehow? I tried using "delete inputTextBox;" when i jumped to each new frame but it then stops accepting anything at all.

Cheers,
Rupert

farafiro
06-11-2003, 10:31 AM
u can do one of these
to delete the variables use delete variableName
or u can deckare a new variable in each frame depending on the frameNum, then pass the value to the value that belongs to that frame
something likevarArray = new Array();
for (var i = 1; i<=_totalframes; i++) {
varArray.push("myVar"+i);
trace(varArray);
}
//then with the button
my_btn.onRelease = function() {
this["mayVar"+_currentframe] = myText.text;
trace("mayVar"+_currentframe+" value is: "+this["mayVar"+_currentframe]);
};

Rupert
06-12-2003, 01:22 AM
No luck with the delete variableName - as I said it just kills everthing. However let me see if I can get anywhere with your other suggestion.

Looks good just from reading it now - I'll let you know.

Thanks!

sneeuwitje
06-13-2003, 01:43 AM
Maybe it will just work when you change the .text property of the textfield and it will change the variable with it:
instance name: input_text_box
variable name: inputTextBoxmyButton.onRelease = function () {
input_text_box.text = "my new text";
trace("inputTextBox = "+inputTextBox);
};

Rupert
06-13-2003, 01:47 AM
Good suggestion - I'll give it a try.

Thanks!