Stick Page Forums Archive

AS2 problem

Started by: no one | Replies: 5 | Views: 601

no one

Posts: 12
Joined: Apr 2009
Rep: 10

View Profile
Sep 11, 2009 7:01 AM #486222
I tried to make a game in Flash CS3. I converted the thing I want to script into a movie clip symbol, double click at it and wrote down these:


onClipEvent (load) {
power = 0.3;
yspeed = 0;
xspeed = 0;
friction = 0.95;
}
onClipEvent (enterFrame) {
if (Key.isDown(Key.LEFT)) {
xspeed -= power;
}
if (Key.isDown(Key.RIGHT)) {
xspeed += power;
}
if (Key.isDown(Key.UP)) {
yspeed -= power;
}
if (Key.isDown(Key.DOWN)) {
yspeed += power;
}
xspeed *= friction;
yspeed *= friction;
_y += yspeed;
_x += xspeed;
}


When I checked the mistake that I might make, it kept telling me:

1087: Syntax error: extra characters found after end of program. onClipEvent (load) {

Can somebody tell me how to solve this?
name:ace
2

Posts: 50
Joined: Feb 2008
Rep: 10

View Profile
Sep 11, 2009 7:45 AM #486227
I only have very little experience programing in flash, but it may be because you have a space between "onClipEvent" and "(load)", so it should look like this-

onClipEvent(load) {

That's my first guess.
adamthud2
2

Posts: 1
Joined: Sep 2009
Rep: 10

View Profile
Sep 11, 2009 7:47 AM #486228
ok dude i under stand
Steyene

Posts: 2,060
Joined: Apr 2006
Rep: 10

View Profile
Sep 11, 2009 8:11 AM #486233
Nope, you can't just import AS2 into CS3 unless you have specified that you are using an as2 file type.

If the file is an AS3 on, you can't put any code on an object. Nor really should you in As2. The code is fine, but it wont work for as3.
no one

Posts: 12
Joined: Apr 2009
Rep: 10

View Profile
Sep 11, 2009 9:54 AM #486246
So how can I change the setting to make it load AS2?
Steyene

Posts: 2,060
Joined: Apr 2006
Rep: 10

View Profile
Sep 11, 2009 11:43 AM #486255
In CS3 make a new file, but instead of choosing the AS3 file option, choose the AS2 file.
Website Version: 1.0.4
© 2025 Max Games. All rights reserved.