home *** CD-ROM | disk | FTP | other *** search
/ Neil's C++ Stuff / 2016-02-neilstuff-weebly.iso / apps / audioPlayer2.swf / scripts / __Packages / Control.as < prev    next >
Text File  |  2016-02-05  |  2KB  |  84 lines

  1. class Control extends MovieClip
  2. {
  3.    function Control()
  4.    {
  5.       super();
  6.       AsBroadcaster.initialize(this);
  7.       if(this.state == "play")
  8.       {
  9.          this.pause_mc._visible = false;
  10.       }
  11.       else
  12.       {
  13.          this.play_mc._visible = false;
  14.       }
  15.       this.realWidth = this.background_mc._width;
  16.       this.background_mc.hover_mc._visible = this.play_mc.hover_mc._visible = this.pause_mc.hover_mc._visible = false;
  17.    }
  18.    function onRollOver()
  19.    {
  20.       this._switch(true);
  21.    }
  22.    function onRollOut()
  23.    {
  24.       this._switch(false);
  25.    }
  26.    function onReleaseOutside()
  27.    {
  28.       this._switch(false);
  29.    }
  30.    function onRelease()
  31.    {
  32.       this.toggle(true);
  33.    }
  34.    function _switch(toggle)
  35.    {
  36.       if(this.state == "play")
  37.       {
  38.          this.play_mc.hover_mc._visible = toggle;
  39.       }
  40.       if(this.state == "pause")
  41.       {
  42.          this.pause_mc.hover_mc._visible = toggle;
  43.       }
  44.       this.background_mc.hover_mc._visible = toggle;
  45.    }
  46.    function toggle(broadcast)
  47.    {
  48.       if(broadcast == undefined)
  49.       {
  50.          broadcast = false;
  51.       }
  52.       if(this.state == "play")
  53.       {
  54.          if(broadcast)
  55.          {
  56.             this.broadcastMessage("onPlay");
  57.          }
  58.          this.play_mc._visible = false;
  59.          this.play_mc.hover_mc._visible = false;
  60.          this.pause_mc._visible = true;
  61.          this.state = "pause";
  62.       }
  63.       else
  64.       {
  65.          if(broadcast)
  66.          {
  67.             this.broadcastMessage("onPause");
  68.          }
  69.          this.pause_mc._visible = false;
  70.          this.pause_mc.hover_mc._visible = false;
  71.          this.play_mc._visible = true;
  72.          this.state = "play";
  73.       }
  74.    }
  75.    function flip()
  76.    {
  77.       this.background_mc._rotation = 180;
  78.       this.background_mc._y += this.background_mc._height;
  79.       this.background_mc._x += this.background_mc._width;
  80.       this.play_mc._x = 14;
  81.       this.pause_mc._x = 13;
  82.    }
  83. }
  84.