# 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:** 14\
**Page:** 2

<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, 5:11pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/21 "2004-02-06T17:11:42Z")

</div>

What doesn’t work?

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, 5:12pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/22 "2004-02-06T17:12:09Z")

</div>

Try:

```auto
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] || answers[n][2] == undefined) {
							return true;
						}
					}
				}
			}
		}
	}
}

```

OMG, that was a bad bad code 😛

---

<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, 5:19pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/23 "2004-02-06T17:19:54Z")

</div>

LOL, i never even specify the answers that are correct???

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] || answers[n][2] == undefined) {  
return true;  
}  
}  
}  
}  
}  
}  
}

LIKE THIS???

---

<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, 5:22pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/24 "2004-02-06T17:22:57Z")

</div>

Place the following code on a frame:

```auto
answers = [["+Tcos45", "-Rcos60"], ["apple", "orange"],["car","bus","plane"]];//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]) {
                                        for (var i = 1; i<=5; i++) {
                                                if (this["Scene12input"+i] == answers[n][2] || answers[n][2] == undefined) {
                                                        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 6, 2004, 5:34pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/25 "2004-02-06T17:34:59Z")

</div>

hey claudio, thats the same old problem…  
i enter one correct ans “bus” , it also goes to next scene…

Ps: the answers now are all three answers in one set, thanks…

---

<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, 5:39pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/26 "2004-02-06T17:39:35Z")

</div>

I didnt understand whats the problem. :q:

---

<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, 5:45pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/27 "2004-02-06T17:45:21Z")

</div>

there are three answers u need to answer correctly…  
“bus”, “plane”, “car”

The problem in the code is that when i input only one answer “bus” and press submit, it goes to the next scene…(-:

---

<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, 6:02pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/28 "2004-02-06T18:02:05Z")

</div>

Weird i just tested here and it seems to work.

---

<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, 6:05pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/29 "2004-02-06T18:05:56Z")

</div>

it works?? hmm…:h:

i just input the word “car” and presses submit, it show the debug window “success” which means its goes to next frame…

---

<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, 6:09pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/30 "2004-02-06T18:09:21Z")

</div>

Check my attachment, i think its working.

---

<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, 6:13pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/31 "2004-02-06T18:13:21Z")

</div>

now thats kinda weird…  
does the input box need to have the same variable name as urs fla… i dont think so…

---

<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, 6:15pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/32 "2004-02-06T18:15:43Z")

</div>

Yes, it has to be Scene12input1, Scene12input2,…, Scene12input5  
I thought you had that on your file so i didnt even mention.

> \*Originally posted by MaTilDA \*  
> \*\*…basically there are 5 input boxes: scene12input1 - scene12input5… \*\*

---

<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, 6:17pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/33 "2004-02-06T18:17:52Z")

</div>

oh gosh:upset:  
but previous i have named it input 1-5 now now i have to proceed on which i have labelled 6 - 10…

---

<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, 6:20pm UTC](https://forum.kirupa.com/t/i-need-help-checking-function/41896/34 "2004-02-06T18:20:18Z")

</div>

Hey i GOT IT!!! 😃 😃 😃  
u guys out there earn my respect, u help me greatly, thanks to claudio and scotty…

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