# I need help ( checking function)

**URL:** <https://forum.kirupa.com/t/i-need-help-checking-function/41896>\
**Category:** flash\
**Created:** [February 3, 2004, 4:22am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896 "2004-02-03T04:22:36Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![MaTilDA](https://avatars.discourse-cdn.com/v4/letter/m/b5ac83/32.png) [@MaTilDA](https://forum.kirupa.com/u/MaTilDA)\
**Post date:** [February 3, 2004, 4:22am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/1 "2004-02-03T04:22:36Z")

</div>

on (release) {  
if (Scene12input1 == “+Tcos45” || scene12input1 == “-Rcos60” && scene12input2 == “+Tcos45” || scene12input2 == “-Rcos60” && scene12input3 == “+Tcos45” || scene12input3 == “-Rcos60” && scene12input4 == “+Tcos45” || scene12input4 == “-Rcos60” && scene12input5 == “+Tcos45” || scene12input5 == “-Rcos60” )  
{  
gotoAndStop(“Scene 12”, 2);  
}

}

It cant seems to work, basically there are 5 input boxes: scene12input1 - scene12input5…

Basically as long as user key in “+Tcos45” and “-Rcos60” in any of the 5 boxes, it will go to frame 2… but it some does not work… 0\_0~~

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 4, 2004, 1:48pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/2 "2004-02-04T13:48:06Z")

</div>

Some works fine but some cant…:trout:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 4, 2004, 2:49pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/3 "2004-02-04T14:49:17Z")

</div>

Try this one (but is the instancename of your button, put the code in a frame)  
[AS]a1 = a2 = a3 = a4 = a5 = atot = 0;  
but.onRelease = function() {  
scene12input1 == “+Tcos45” || scene12input1 == “-Rcos60” ? a1=1 : null;  
scene12input2 == “+Tcos45” || scene12input2 == “-Rcos60” ? a2=1 : null;  
scene12input3 == “+Tcos45” || scene12input3 == “-Rcos60” ? a3=1 : null;  
scene12input4 == “+Tcos45” || scene12input4 == “-Rcos60” ? a4=1 : null;  
scene12input5 == “+Tcos45” || scene12input5 == “-Rcos60” ? a5=1 : null;  
atot = a1+a2+a3+a4+a5;  
atot == 5 ? gotoAndStop(“Scene12”, 2) : null;  
};  
[/AS]

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 1:07am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/4 "2004-02-05T01:07:51Z")

</div>

Eh it cant work upon reaching the screen, the input boxes are filled with default textx like “\_level0.scene12input3”

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 2:29am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/5 "2004-02-05T02:29:12Z")

</div>

Try:

```auto
on (release) {
	for (var i = 1; i<=5; i++) {
		if (this["Scene12input"+i] == "+Tcos45" || this["Scene12input"+i] == "-Rcos60") {
			trace("success");
			gotoAndStop("Scene 12", 2);
			break;
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:06am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/6 "2004-02-05T03:06:49Z")

</div>

Thanks a lot but it also goes to next scene even though u enter onli one correct answer…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:13am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/7 "2004-02-05T03:13:32Z")

</div>

> \*Originally posted by MaTilDA \*  
> **Basically as long as user key in “+Tcos45” and “-Rcos60” in any of the 5 boxes, it will go to frame 2.**  
> Isnt that what you want??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:16am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/8 "2004-02-05T03:16:18Z")

</div>

Basically as long as user key in “+Tcos45” and “-Rcos60” in any of the 5 boxes, it will go to frame 2.

its Both must key in… “+Tcos45” AND “-Rcos60” not or…

:h:

As long as two out of the five boxes have “+Tcos45” and “-Rcos60”… it will got to next frame…

Thanks claudio…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:27am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/9 "2004-02-05T03:27:14Z")

</div>

Ahh i get it now… try:

```auto
on (release) {
	for (var i = 1; i<=5; i++) {
		if (this["Scene12input"+i] == "+Tcos45") {
			for (var i = 1; i<=5; i++) {
				if (this["Scene12input"+i] == "-Rcos60") {
					trace("success");
					gotoAndStop("Scene 12", 2);
					break;
				}
			}
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:33am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/10 "2004-02-05T03:33:16Z")

</div>

OMG!!! IT reallie works…

One last thing to solve:

How abt there are four sets of correct answers…

For example the first sets of answers are “+Tcos45” , “-Rcos60”

second sets is “apple” , “orange”, etc…

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 3:56am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/11 "2004-02-05T03:56:34Z")

</div>

Ah let me take another road then…  
Place the following code on a frame:

```auto
answers = [["+Tcos45", "-Rcos60"], ["apple", "orange"]];//add the other pairs here
function validate(n) {
	for (var i = 1; i<=5; i++) {
		if (this["Scene12input"+i] == answers[n][0]) {
			for (var i = 1; i<=5; i++) {
				if (this["Scene12input"+i] == answers[n][1]) {
					return true;
				}
			}
		}
	}
}

```

And this one on the button:

```auto
on (release) {
	for (var i = 0; i<answers.length; i++) {
		if (validate(i)) {
			trace("success");
			gotoAndStop("Scene 12", 2);
			break;
		}
	}
}

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 5:30am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/12 "2004-02-05T05:30:37Z")

</div>

🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 5, 2004, 5:47am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/13 "2004-02-05T05:47:56Z")

</div>

what if there are three answers in one set of answer???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 4:16am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/14 "2004-02-06T04:16:50Z")

</div>

Try to add another for if statement but cant ???  
??

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 9:12am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/15 "2004-02-06T09:12:44Z")

</div>

[AS]answers = [["+Tcos45", “-Rcos60”, “+Ltan30”], [“apple”, “orange”, “citron”]];  
function validate(n) {  
for (var i = 1; i\<=5; i++) {  
for (var k = 1; k\<=3; k++) {  
if (this[“Scene12input”+i] == answers[n][k]) {  
return true;  
}  
}  
}  
}[/AS]  
Not tested but give it try:)

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 10:13am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/16 "2004-02-06T10:13:34Z")

</div>

Answers will be ckecked upon clicking a button…  
So what actions should be perform at the button???

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 11:20am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/17 "2004-02-06T11:20:30Z")

</div>

Sorry I didn’t tell. Like the one Claudio gave you  
[AS]on (release) {  
for (var i = 0; i\<answers.length; i++) {  
if (validate(i)) {  
trace(“success”);  
gotoAndStop(“Scene 12”, 2);  
break;  
}  
}  
}  
[/AS]

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 11:59am UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/18 "2004-02-06T11:59:48Z")

</div>

quite a lot of errors, no matter what i input, it just go to next scene…:red:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 3:50pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/19 "2004-02-06T15:50:42Z")

</div>

[AS]answers = [["+Tcos45", “-Rcos60”, “+Ltan30”], [“apple”, “orange”, “citron”]];  
function validate(n) {  
for (var i = 1; i\<=5; i++) {  
if (this[“Scene12input”+i] == answers[n][0]) {  
for (var i = 1; i\<=5; i++) {  
if (this[“Scene12input”+i] == answers[n][1]) {  
for (var i = 1; i\<=5; i++) {  
if (this[“Scene12input”+i] == answers[n][2]) {  
return true;  
}  
}  
}  
}  
}  
}  
}[/AS]

code on your button stays the same

scotty(-:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [February 6, 2004, 4:56pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/20 "2004-02-06T16:56:18Z")

</div>

it cant work either???

[Next page](https://forum.kirupa.com/t/i-need-help-checking-function/41896.md?page=2)
