home *** CD-ROM | disk | FTP | other *** search
/ T-Online 6 / T-Online.iso / Animation / content / intro / intro.swf / scripts / __Packages / components / ui / SimpleButtonLogic.as < prev   
Encoding:
Text File  |  2005-10-20  |  1.8 KB  |  91 lines

  1. class components.ui.SimpleButtonLogic extends components.ui.GenericUIComponent
  2. {
  3.    var event;
  4.    function SimpleButtonLogic()
  5.    {
  6.       super();
  7.       this.tabEnabled = false;
  8.       this.event = new application.core.EventDispatcher();
  9.       this.gotoAndStop(1);
  10.       this.enable();
  11.    }
  12.    function addListener(holder)
  13.    {
  14.       this.event.addListener(holder);
  15.    }
  16.    function removeListener(holder)
  17.    {
  18.       this.event.removeListener(holder);
  19.    }
  20.    function onBtnRollOver()
  21.    {
  22.       this.gotoAndStop(2);
  23.    }
  24.    function onBtnRollOut()
  25.    {
  26.       this.gotoAndStop(1);
  27.    }
  28.    function onBtnPress()
  29.    {
  30.       this.gotoAndStop(3);
  31.    }
  32.    function onBtnRelease()
  33.    {
  34.       this.gotoAndStop(2);
  35.    }
  36.    function onBtnReleaseOutside()
  37.    {
  38.       this.gotoAndStop(1);
  39.    }
  40.    function enable()
  41.    {
  42.       this.enabled = true;
  43.       this.useHandCursor = true;
  44.    }
  45.    function disable()
  46.    {
  47.       this.enabled = false;
  48.       this.useHandCursor = false;
  49.    }
  50.    function onRollOver()
  51.    {
  52.       if(this.enabled)
  53.       {
  54.          this.event.dispatchEvent("onBtnRollOver",this);
  55.          this.onBtnRollOver();
  56.       }
  57.    }
  58.    function onRollOut()
  59.    {
  60.       if(this.enabled)
  61.       {
  62.          this.event.dispatchEvent("onBtnRollOut",this);
  63.          this.onBtnRollOut();
  64.       }
  65.    }
  66.    function onPress()
  67.    {
  68.       if(this.enabled)
  69.       {
  70.          this.event.dispatchEvent("onBtnPressed",this);
  71.          this.onBtnPress();
  72.       }
  73.    }
  74.    function onRelease()
  75.    {
  76.       if(this.enabled)
  77.       {
  78.          this.event.dispatchEvent("onBtnReleased",this);
  79.          this.onBtnRelease();
  80.       }
  81.    }
  82.    function onReleaseOutside()
  83.    {
  84.       if(this.enabled)
  85.       {
  86.          this.event.dispatchEvent("onBtnReleasedOutside",this);
  87.          this.onBtnReleaseOutside();
  88.       }
  89.    }
  90. }
  91.