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~~
system
February 4, 2004, 1:48pm
2
Some works fine but some cant…:trout:
system
February 4, 2004, 2:49pm
3
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(-:
system
February 5, 2004, 1:07am
4
Eh it cant work upon reaching the screen, the input boxes are filled with default textx like “_level0.scene12input3”
system
February 5, 2004, 2:29am
5
Try:
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;
}
}
}
system
February 5, 2004, 3:06am
6
Thanks a lot but it also goes to next scene even though u enter onli one correct answer…
system
February 5, 2004, 3:16am
8
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…
system
February 5, 2004, 3:27am
9
Ahh i get it now… try:
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;
}
}
}
}
}
system
February 5, 2004, 3:33am
10
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…
system
February 5, 2004, 3:56am
11
Ah let me take another road then…
Place the following code on a frame:
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:
on (release) {
for (var i = 0; i<answers.length; i++) {
if (validate(i)) {
trace("success");
gotoAndStop("Scene 12", 2);
break;
}
}
}
system
February 5, 2004, 5:47am
13
what if there are three answers in one set of answer???
system
February 6, 2004, 4:16am
14
Try to add another for if statement but cant ???
??
system
February 6, 2004, 9:12am
15
[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(-:
system
February 6, 2004, 10:13am
16
Answers will be ckecked upon clicking a button…
So what actions should be perform at the button???
system
February 6, 2004, 11:20am
17
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(-:
system
February 6, 2004, 11:59am
18
quite a lot of errors, no matter what i input, it just go to next scene…:red:
system
February 6, 2004, 3:50pm
19
[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(-: