I’m trying to follow along with Lynda.com’s “Building Particle Systems” lesson.
I’ve made a .as file with the following code:
package CustomClasses.Particle
{
import flash.display.*;
public class Particle extends Sprite
{
public xVelocity:Number;
public yVelocity:Number;
public function Particle()
{
xVelocity = 0;
yVelocity = 0;
}
public function update():void
{
this.x += xVelocity;
this.y += yVelocity;
}
}
}
I then made a Flash file with a movie clip and this code:
dot.xVelocity = 5;
dot.yVelocity = -1;
function updateBall(event:Event):void
{
dot.update();
}
addEventListener(Event.ENTER_FRAME, updateBall);
When I try and preview the movie I keep getting errors even though I’ve copied exactly his code in the training video. These are the errors:
1071: Syntax error: expected a definition keyword (such as function) after attribute public, not xVelocity.
1084: Syntax error: expecting rightbrace before semicolon.
5000: The class ‘particle.Particle’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.
Any help would be much appreciated!