1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
|
import mx.utils.Delegate;
import com.services.BuckyServices;
import mx.transitions.easing.*;
import mx.transitions.Tween;
class com.player.Player extends MovieClip
{
var songList:Array;
public static var s:Sound;
var currentSongTitle:String;
var currentSongInfo:String;
var backing:MovieClip;
var collapseBtn:MovieClip;
var infoBtn:MovieClip;
var playPauseBtn:MovieClip;
var collapsed:Boolean;
var dragging:Boolean;
var initted:Boolean;
var infoState:Boolean;
var isPlaying:Boolean;
var title_txt:TextField;
var initBacking:Number;
var oldX:Number;
var oldY:Number;
public function Player() {
initted = dragging = collapsed = infoState = useHandCursor = _focusrect = isPlaying = false;
}
public function init(_inObject:Object):Void {
if (!initted) {
var t:Tween = new Tween(this, "_y", Elastic.easeOut, _y, 120, 1, true);
initted = true;
}
infoBtn.gotoAndStop ("info");
infoBtn._rotation = 0;
infoState = false;
collapseBtn.gotoAndStop ("collapse");
playPauseBtn.gotoAndStop ("pauseIcon");
isPlaying = true;
currentSongTitle = _inObject.filename;
title_txt.text = currentSongTitle;
songList.push (_inObject.theURL);
initBacking = backing._alpha;
currentSongInfo = BuckyServices.activeKeyword + " > " + BuckyServices.activeThread;
stopAllSounds();
s = new Sound(_root);
s.loadSound ( _inObject.theURL , true );
s.start();
}
private function doCollapse():Void {
if (!collapsed) {
oldX = _x; oldY = _y;
var vFunc:Function = function () {
var xTween = new Tween(this, "_x", Regular.easeOut, _x, 11, .2, true);
var yTween = new Tween(this, "_y", Regular.easeOut, _y, 9, .2, true);
collapsed = true;
}
var bTween = new Tween (collapseBtn, "_rotation", Regular.easeOut, collapseBtn._rotation, 90, .4, true);
var rTween = new Tween (this, "_rotation", Regular.easeOut, _rotation, -90, .4, true);
rTween.onMotionFinished = Delegate.create (this, vFunc);
} else {
var xTween = new Tween(this, "_x", Regular.easeOut, _x, oldX, .4, true);
var bTween = new Tween (collapseBtn, "_rotation", Elastic.easeOut, collapseBtn._rotation, 0, .8, true);
var yTween = new Tween(this, "_y", Regular.easeOut, _y, oldY, .4, true);
rTween = new Tween (this, "_rotation", Regular.easeOut, _rotation, 0, .4, true);
collapsed = false;
}
}
private function doInfoBtn():Void {
var r:Number = infoState == true ? 0 : 180;
title_txt.text = infoState == true ? currentSongTitle : currentSongInfo;
new Tween(infoBtn, "_rotation", Regular.easeOut, infoBtn._rotation, r, .4, true);
infoState = !infoState;
}
private function doPlayPause():Void {
if (isPlaying) { s.stop(); isPlaying = false; playPauseBtn.gotoAndStop ("playIcon"); }
else { s.start(); isPlaying = true; playPauseBtn.gotoAndStop ("pauseIcon"); }
}
private function onPress():Void {
if (collapseBtn.hitTest (_root._xmouse, _root._ymouse)) {
doCollapse();
}
else if (infoBtn.hitTest (_root._xmouse, _root._ymouse))
{
doInfoBtn();
}
else if (playPauseBtn.hitTest (_root._xmouse, _root._ymouse))
{
doPlayPause();
}
else {
var aTween:Tween = new Tween(this, "_alpha", Regular.easeOut, _alpha, 20, .4, true);
startDrag(this);
}
}
private function onRelease():Void {
stopDrag();
var aTween:Tween = new Tween(this, "_alpha", Regular.easeOut, _alpha, 100, .4, true);
}
}
|