package {
import flash.display.Sprite;
import flash.events.Event;

public class bar extends Sprite {
    // -----------------------------
    // Properties
    // -----------------------------
    
    // delta: The number of pixels by which to offset the sprite
    //        along the x dimension on each successive frame.
    private var _delta:Number;
    public function get delta():Number {return _delta; }
    public function set delta(value:Number):void { _delta = value; }
    
    // -----------------------------
    // constructor -- bar
    // -----------------------------
    
    public function bar() {
        this.graphics.beginFill(0x0000f, 100);
        this.graphics.drawCircle(0, 0, 5);
        this.graphics.endFill();
        this.x = 50;
        this.y = 100;
        
        delta = 1;    // see onEnterFrame()
        
        // Listen for ENTER_FRAME events, so that we can animate
        // the child sprite.
        addEventListener(Event.ENTER_FRAME, onEnterFrame);        
    }
    
    // -----------------------------
    // onEnterFrame
    // -----------------------------
    
    /**
     *  Called by the Flash player on each successive
     *  frame.
     *  
     *  Notice that onEnterFrame() does not actually draw
     *  anything. It just alters the state of the thing
     *  to be drawn (that is, of this' x position).
     */
    
    public function onEnterFrame(event:Event):void {
        this.x += delta;
    }    
} // class
} // package