From 79670053c7247d3a49b607960efd284e93f057e5 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Fri, 2 Aug 2013 17:14:26 -0500 Subject: install.pl --- bPod/com/player/Player.as | 131 +++++++++++++++++++++++++++++++++++++++++++++ bPod/com/player/Visuals.as | 85 +++++++++++++++++++++++++++++ 2 files changed, 216 insertions(+) create mode 100644 bPod/com/player/Player.as create mode 100644 bPod/com/player/Visuals.as (limited to 'bPod/com/player') diff --git a/bPod/com/player/Player.as b/bPod/com/player/Player.as new file mode 100644 index 0000000..81acd3b --- /dev/null +++ b/bPod/com/player/Player.as @@ -0,0 +1,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); + } + +} \ No newline at end of file diff --git a/bPod/com/player/Visuals.as b/bPod/com/player/Visuals.as new file mode 100644 index 0000000..2a4ac7b --- /dev/null +++ b/bPod/com/player/Visuals.as @@ -0,0 +1,85 @@ + + +class com.player.Visuals extends MovieClip { + +// private var theRoot:MovieClip; + private var numParticles:Number = 10; + private var minDist:Number = 50; + private var springAmount:Number = .001; + + private var vbounds:MovieClip; + + public function Visuals() {} + + public function init():Void + { + setMask (vbounds); + + for(var i:Number=0; i< numParticles;i++) { + var particle:MovieClip = this.attachMovie("particle", "p" + i, i); + particle._x = Math.random() * vbounds._width; + particle._y = Math.random() * vbounds._height; + particle.vx = Math.random() * 6 - 3; + particle.vy = Math.random() * 6 - 3; + particle._xscale = particle._yscale = 10 + Math.random() * 100; + particle.mass = particle._xscale / 100; + } + +// onEnterFrame = initAnimation; + + + } + + private function onEnterFrame():Void + { + for(var i:Number = 0;i vbounds._width) { + particle._x = vbounds._x; + } + else if(particle._x < -10) { + particle._x = vbounds._width; + } + if(particle._y > vbounds._height) { + particle._y = vbounds._y; + } + else if(particle._y < -46) { + particle._y = vbounds._height; + } + } + + clear(); + for(i=0;i