Panel Control : Controls : Graphics Flash / Flex / ActionScript examples


Flash / Flex / ActionScript examples » Graphics » Controls »

 

Panel Control


 
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(0010216);
            graphics.endFill(  );
            
            graphics.beginFill(0x000000);
            graphics.drawRect(50 + pan * 500216);
        }
    }
}

        



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


Flash / Flex / ActionScript examples

 Navioo Graphics
» Controls