Copy link to clipboard
Copied
Hi,
I have a very slight problem with a form.
I have in my frame0 a form to switch to frame1 :
this.stop();
var root = this;
var responseTF = this.responseTF;
var motdepassatrouver = "1234";
var input, button;
function onDrawEnd() {
input = document.getElementById("mdp");
button = document.getElementById("valider");
button.addEventListener("click", validate);
}
function validate() {
var value = input.value;
if (value === "")
responseTF.text = "MOT DE PASSE INCORRECT";
else if (value === motdepassatrouver) {
responseTF.text = "MOT DE PASSE CORRECT";
root.gotoAndStop(1);
} else {
responseTF.text = "MOT DE PASSE INCORRECT";
}
input.value = "";
}
stage.on("drawend", onDrawEnd, root, true);
Everything is working.
And in frame1 I also use this same form to switch to frame2. I changed the names of variable and function but it blocks :
var root2 = this;
var responseTF2 = this.responseTF2;
var motdepassatrouver2 = "1234";
var input2, button2;
function onDrawEnd2() {
input2 = document.getElementById("mdp2");
button2 = document.getElementById("valider2");
button2.addEventListener("click", validate2);
}
function validate2() {
var value2 = input2.value2;
if (value2 === "")
responseTF2.text = "MOT DE PASSE INCORRECT";
else if (value2 === motdepassatrouver2) {
responseTF2.text = "MOT DE PASSE CORRECT";
root2.gotoAndStop(1);
} else {
responseTF2.text = "MOT DE PASSE INCORRECT";
}
input2.value2 = "";
}
stage.on("drawend", onDrawEnd2, root2, true);
I did various tests but I can't see what is blocking.
I attached the file.
Thank you in advance for your help and answers.
Have a good day.
Hi.
Thank you for the file.
Change the .value2 property on these two lines to .value because this is a property that belongs to the text element.
var value2 = input2.value2; // change to .value
input2.value2 = ""; // change to .value
Also, in my case, I had do place the root2.responseTF2 text field inside of a Movie Clip instance to get a valid reference. In this way, I changed this line:
var responseTF2 = this.responseTF2; // changed to this.movieClipContainerName.responseTF2
I hope this
...Copy link to clipboard
Copied
in the code of frame1 I put
root2.gotoAndStop(2);
but that's not the problem
Copy link to clipboard
Copied
I don't really understand my mistake,
if anyone sees anything i thank you in advance
Copy link to clipboard
Copied
Hi.
Thank you for the file.
Change the .value2 property on these two lines to .value because this is a property that belongs to the text element.
var value2 = input2.value2; // change to .value
input2.value2 = ""; // change to .value
Also, in my case, I had do place the root2.responseTF2 text field inside of a Movie Clip instance to get a valid reference. In this way, I changed this line:
var responseTF2 = this.responseTF2; // changed to this.movieClipContainerName.responseTF2
I hope this helps and please let me know if it doesn't work.
Regards,
JC
Copy link to clipboard
Copied
Great, thank you very much, it works.
Thanks for your help.
Copy link to clipboard
Copied
You're welcome!