• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

problem form

Community Beginner ,
Sep 04, 2022 Sep 04, 2022

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.

 

Views

319

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 13, 2022 Sep 13, 2022

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

...

Votes

Translate

Translate
Community Beginner ,
Sep 04, 2022 Sep 04, 2022

Copy link to clipboard

Copied

in the code of frame1 I put

root2.gotoAndStop(2); 

but that's not the problem

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 07, 2022 Sep 07, 2022

Copy link to clipboard

Copied

I don't really understand my mistake,
if anyone sees anything i thank you in advance

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 13, 2022 Sep 13, 2022

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

Great, thank you very much, it works.

Thanks for your help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Sep 13, 2022 Sep 13, 2022

Copy link to clipboard

Copied

LATEST

You're welcome!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines