home *** CD-ROM | disk | FTP | other *** search
- class Control extends MovieClip
- {
- var state;
- var pause_mc;
- var play_mc;
- var realWidth;
- var background_mc;
- var broadcastMessage;
- function Control()
- {
- super();
- AsBroadcaster.initialize(this);
- if(this.state == "play")
- {
- this.pause_mc._visible = false;
- }
- else
- {
- this.play_mc._visible = false;
- }
- this.realWidth = this.background_mc._width;
- this.background_mc.hover_mc._visible = this.play_mc.hover_mc._visible = this.pause_mc.hover_mc._visible = false;
- }
- function onRollOver()
- {
- this._switch(true);
- }
- function onRollOut()
- {
- this._switch(false);
- }
- function onReleaseOutside()
- {
- this._switch(false);
- }
- function onRelease()
- {
- this.toggle(true);
- }
- function _switch(toggle)
- {
- if(this.state == "play")
- {
- this.play_mc.hover_mc._visible = toggle;
- }
- if(this.state == "pause")
- {
- this.pause_mc.hover_mc._visible = toggle;
- }
- this.background_mc.hover_mc._visible = toggle;
- }
- function toggle(broadcast)
- {
- if(broadcast == undefined)
- {
- broadcast = false;
- }
- if(this.state == "play")
- {
- if(broadcast)
- {
- this.broadcastMessage("onPlay");
- }
- this.play_mc._visible = false;
- this.play_mc.hover_mc._visible = false;
- this.pause_mc._visible = true;
- this.state = "pause";
- }
- else
- {
- if(broadcast)
- {
- this.broadcastMessage("onPause");
- }
- this.pause_mc._visible = false;
- this.pause_mc.hover_mc._visible = false;
- this.play_mc._visible = true;
- this.state = "play";
- }
- }
- function flip()
- {
- this.background_mc._rotation = 180;
- this.background_mc._y += this.background_mc._height;
- this.background_mc._x += this.background_mc._width;
- this.play_mc._x = 14;
- this.pause_mc._x = 13;
- }
- }
-