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

Home
Flash / Flex / ActionScript
1.Animation
2.Array
3.Class
4.Data Type
5.Development
6.Function
7.Graphics
8.Language
9.Network
10.Regular Expressions
11.Statement
12.String
13.TextField
14.XML
Flash / Flex / ActionScript » 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);
        }
    }
}

        
Related examples in the same category
1.Volume Control
2.Draw the Play/Pause graphic
3.Creating an Item Renderer
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.