the add, eq and ne keywords don't exist in AS2. They were marked
deprecated in MX 2004, and appearantly gotten rid of in 8.
add is now + or the String .concat() method
eq is now == or ===
ne is now != or !==
What you want is:
on (release, keyPress "<Enter>") {
if (user + pass == "xxxxx" + "xxxxx!") {
gotoAndPlay("Scene 5", 3);
} else if (user + pass != "xxxxx" + "xxxxx!") {
gotoAndPlay("tryagain", 1);
}
}
BTW: The second condition can even be removed entirely. If the first
condition is not true, the second will always be true. So:
on (release, keyPress "<Enter>") {
if (user + pass == "xxxxx" + "xxxxx!") {
gotoAndPlay("Scene 5", 3);
} else {
gotoAndPlay("tryagain", 1);
}
}
Will suffice.
Manno
[quoted text, click to view] devunit wrote:
> Can anyone give me an idea why this script will work in Flash 7 , but gives the
> error code in Flash 8?
>
> on (release, keyPress "<Enter>") {
> if (user add pass eq "xxxxx" add "xxxxx!") {
> gotoAndPlay("Scene 5", 3);
> } else if (user add pass ne "xxxxx" add "xxxxx!") {
> gotoAndPlay("tryagain", 1);
> }
> }
>
> Here's the error message
>
> **Error** Scene=animated opening, layer=Layer 3, frame=6:Line 2: ')' expected
> if (user add pass eq "xxxxx" add "xxxxx") {
>
> **Error** Scene=animated opening, layer=Layer 3, frame=6:Line 3: Statement
> must appear within on handler
> gotoAndPlay("Scene 5", 3);
>
> **Error** Scene=animated opening, layer=Layer 3, frame=6:Line 4: Unexpected
> '}' encountered
> } else if (user add pass ne "xxxxx" add "xxxxx!") {
>
> Thanks!
>
--
----------
Manno Bult