Flash MX 2004 MP3 Player Pg.11
source: http://www.thegoldenmean.com/
11 — Setup Panel Code
Setup Panel Code
For the truly committed among you, here is the code that relates to the setup_mc control module. I won’t write any commentary - the comments included should make sense to you by now.
//Tweening and easing classes
import mx.transitions.Tween;
import mx.transitions.easing.*;
this.attachMovie("setup_module", "setup_mc", 10);
//The default state for Player is high bandwidth and linear
//play mode so light up those buttons to start off
setup_mc.high_mc.gotoAndStop("checked");
setup_mc.linear_mc.gotoAndStop("checked");
//continue button animates setup_mc off stage and moves main
//timelineto the final frame, which starts everything going
setup_mc.continue_mc.onRelease = function ():Void {
//create reference to player for nested function
var player:MovieClip = this._parent._parent;
var revealTween:Object = new Tween(this._parent, "_y",
Strong.easeInOut, 0, this._parent._height, 2, true);
revealTween.onMotionFinished = function() {
player.play();//I know it sounds redundant....
}
}
setup_mc.shuffle_mc.onRelease = function():Void {
this.gotoAndStop("checked");
setup_mc.linear_mc.gotoAndStop("unchecked");
this._parent._parent.shuffle_mc.gotoAndStop("checked");
shuffle = true;
}
//this selects "shuffle" as the play mode and turns the shuffle_mc
//button "on" in both the setup_mc and the main Player interface
setup_mc.linear_mc.onRelease = function():Void {
this.gotoAndStop("checked");
setup_mc.shuffle_mc.gotoAndStop("unchecked");
this._parent._parent.shuffle_mc.gotoAndStop("unchecked");
shuffle = false;
}
setup_mc.high_mc.onRelease = function():Void {
this.gotoAndStop("checked");
setup_mc.low_mc.gotoAndStop("unchecked");
_soundbuftime = 5;
}
setup_mc.low_mc.onRelease = function():Void {
this.gotoAndStop("checked");
setup_mc.high_mc.gotoAndStop("unchecked");
_soundbuftime = 10;
}
stop();
With the setup panel dealt with, let’s finish this Player!
--top--