package{
import flash.display.*;
import flash.events.*;
public class Main extends Sprite {
public var pan:Number = 0;
public function Main( )
{
addEventListener(MouseEvent.CLICK, onClick);
draw( );
}
public function onClick(event:MouseEvent):void
{
pan = event.localX / 50 - 1;
draw( );
dispatchEvent(new Event(Event.CHANGE));
}
private function draw( ):void {
graphics.beginFill(0xcccccc);
graphics.drawRect(0, 0, 102, 16);
graphics.endFill( );
graphics.beginFill(0x000000);
graphics.drawRect(50 + pan * 50, 0, 2, 16);
}
}
}
|