home *** CD-ROM | disk | FTP | other *** search
- class extensions.movieclip.SimpleButton
- {
- var MC;
- var rolloutAction = null;
- var rolloverAction = null;
- var releaseoutsideAction = null;
- var releaseAction = null;
- var pressAction = null;
- function SimpleButton(tMC, _release, _rollover, _rollout, _press, _releaseoutside, _dragin, _dragout)
- {
- this.MC = tMC;
- this.MC.isbutton = true;
- this.rolloutAction = _rollout;
- this.rolloverAction = _rollover;
- this.releaseoutsideAction = _releaseoutside != undefined ? _releaseoutside : _release;
- this.releaseAction = _release;
- this.pressAction = _press;
- this.MC.onRollOver = system.Delegate.create(this,this.RollOver);
- this.MC.onRollOut = system.Delegate.create(this,this.RollOut);
- this.MC.onRelease = system.Delegate.create(this,this.Release);
- this.MC.onPress = system.Delegate.create(this,this.Press);
- this.MC.onReleaseOutside = system.Delegate.create(this,this.ReleaseOutside);
- this.MC.onDragOver = _dragin;
- this.MC.onDragOut = _dragout;
- for(var name in this.MC)
- {
- if(name.indexOf("hit") != -1)
- {
- this.MC.hitArea = this.MC[name]._visible = false;
- }
- }
- this.MC.gotoAndPlay("start");
- }
- function RollOut()
- {
- this.MC.gotoAndPlay("rollout");
- this.rolloutAction();
- }
- function RollOver()
- {
- this.MC.gotoAndPlay("rollover");
- this.rolloverAction();
- }
- function ReleaseOutside()
- {
- this.MC.gotoAndPlay("release");
- this.releaseoutsideAction();
- }
- function Release()
- {
- this.MC.gotoAndPlay("release");
- this.releaseAction();
- }
- function Press()
- {
- if(this.pressAction != undefined)
- {
- this.MC.gotoAndPlay("onpress");
- this.pressAction();
- }
- else
- {
- this.MC.gotoAndStop("release");
- }
- }
- }
-