home *** CD-ROM | disk | FTP | other *** search
- package game
- {
- import flash.display.MovieClip;
- import flash.events.MouseEvent;
- import flash.text.TextField;
-
- public class Button extends MovieClip
- {
-
-
- private var toogle:Boolean = false;
-
- public var txt:TextField;
-
- public function Button()
- {
- toogle = false;
- super();
- this.mouseChildren = false;
- this.buttonMode = true;
- this.addEventListener(MouseEvent.MOUSE_OVER,onOver);
- this.addEventListener(MouseEvent.MOUSE_UP,onUp);
- this.addEventListener(MouseEvent.MOUSE_DOWN,onDown);
- this.addEventListener(MouseEvent.MOUSE_OUT,onOut);
- }
-
- private function onDown(param1:MouseEvent) : void
- {
- if(!toogle)
- {
- SoundManager.getInstance().playSound("btnDown",SoundManager.TYPE_BTN);
- this.gotoAndPlay("down");
- }
- }
-
- public function setToogle(param1:Boolean) : void
- {
- if(param1)
- {
- this.gotoAndPlay("down");
- }
- else
- {
- this.gotoAndPlay("up");
- }
- toogle = param1;
- }
-
- private function onOver(param1:MouseEvent) : void
- {
- if(!toogle)
- {
- this.gotoAndPlay("over");
- }
- }
-
- private function onUp(param1:MouseEvent) : void
- {
- if(!toogle)
- {
- this.gotoAndPlay("up");
- }
- }
-
- private function onOut(param1:MouseEvent) : void
- {
- if(!toogle)
- {
- this.gotoAndPlay("up");
- }
- }
- }
- }
-