shuga
October 31, 2002, 9:22pm
1
i copied this code from a book … so you would think it would work
function createEnemy() {
newEnemy++;
if (newWnemy == maxEnemies) {
newEnemy = 1;
}
_root.attachMovie("enemy", "enemy"+newEnemy, newEnemy);
setProperty(eval("enemy"+newEnemy), _x, _root.stageWidth-random(_root.stageWidth));
setProperty(eval("enemy"+newEnemy), _y, -eval("enemy"+newEnemy)._height/2));
}
here’s the error it gives me
Scene=Scene 1, Layer=actions, Frame=2: Line 8: ‘;’ expected
setProperty(eval(“enemy”+newEnemy), _y, -eval(“enemy”+newEnemy)._height/2));
Scene=Scene 1, Layer=actions, Frame=2: Line 9: Unexpected ‘}’ encountered
}
if i take the } off the end that error goes away but that doesnt make sense b/c then it leaves a bracket open
and it gives me the same error for line 8 with or without the ; at the end … but i think it should be there b/c every actionscript line i see has to have ; or { at the end
sigh
help please
system
October 31, 2002, 9:55pm
2
<b>-eval(“enemy”+newEnemy)</b>
Why do you have a minus here infront of this?
Another error:
if (new<b>Wnemy</b> == maxEnemies)
system
October 31, 2002, 10:14pm
3
thx for catching the spelling error.
the - is in front of the eval in the book … i checked
that still doesnt help though with the syntax errors this movie is producing ;(
system
October 31, 2002, 10:31pm
4
Isnt it possibly an error in the book? If its a poorly published book you can expect these kinds of things.
I have never seen that syntax.
system
October 31, 2002, 10:34pm
5
it is possible … but when i take the - away … i still get the same errors. and thats not causing an error at the moment ;(
system
October 31, 2002, 10:35pm
6
setProperty(eval("enemy"+newEnemy), _y, -eval("enemy"+newEnemy)._height/2));
Count the ( and the ). Compare. Correct.
pom
system
October 31, 2002, 10:41pm
7
Ding Ding Ding, I know the problem and I do it all the time, I am getting used to not doing it now though.