I am practicing from a book and places the script in a keyframe in a designated script layer
I have gone over it a few times and can't figure out what
1037: packages cannot be nested means.
here is the code:
package {
import flash.display.Sprite;
import flash.events.Event;
public class Velocity extends Sprite {
private var _sprite:Sprite;
private var _vx:Number = 3;
public function Velocity () {
_sprite =new Sprite();
_sprite.graphics.beginFill(0x0000ff, 100);
_sprite.graphics.drawCircle(0, 0, 25);
_sprite.graphics.endFill();
_sprite.x =50;
_sprite.y =100;
addChild (_sprite);
addEventListener(Event.ENTER_FRAME, onEnterFrame);
}
public function onEnterFrame(event:Event):void{ _sprite.x += _vx;
}
}
}
If it works it will create a shape and animate it.
Any suggestions?





Bookmarks