CURRENT PROJECTS
loading
class Throbber extends MovieClip { private var _leafSize:Number = 4; private var _cycleSpeed:Number = 1000; private var _color:Number = 0x808080; private var _leafCount:Number = 12; private var _trailCount:Number = 5; private var _circleRadius:Number = 10; private var _startLeaf:Number = 9; private var _padding:Number = 10; private var throbber:MovieClip; private var leafNodeItr:Number = 1; private var interval; // no constructor function init(width:Number, height:Number, Txt:String) { this.throbber = this.createEmptyMovieClip("throbber", this.getNextHighestDepth()); this.throbber._x = this._circleRadius + this._padding; this.throbber._y = 0; var offsetMilliseconds = new Date().getMilliseconds(); var offsetLeafCnt:Number; for (var i=this._startLeaf; i < (this._leafCount + this._startLeaf); i++) { offsetLeafCnt = i - this._startLeaf + 1; this.throbber["leaf" + offsetLeafCnt] = this.throbber.createEmptyMovieClip("leaf" + offsetLeafCnt, this.throbber.getNextHighestDepth()); //this.drawLeafCircle(this.throbber["leaf" + offsetLeafCnt], (Math.cos((i * (360 / this._leafCount)) * (3.14/180)) * this._circleRadius), (Math.sin((i * (360 / this._leafCount)) * (3.14/180)) * this._circleRadius)); this.drawLeafStub(this.throbber["leaf" + offsetLeafCnt], (Math.cos((i * (360 / this._leafCount)) * (3.14/180)) * this._circleRadius), (Math.sin((i * (360 / this._leafCount)) * (3.14/180)) * this._circleRadius)); this.throbber["leaf" + offsetLeafCnt]._alpha = 25; } this.interval = setInterval( mx.utils.Delegate.create(this, function () { if (this.leafNodeItr > this._leafCount) this.leafNodeItr = 1; var preLo = (this._trailCount > this.leafNodeItr) ? 0 : (this.leafNodeItr - this._trailCount); var preHi = this.leafNodeItr; var apreLo = (this._trailCount > this.leafNodeItr) ? (this._leafCount - (this._trailCount - this.leafNodeItr)) : this._leafCount; var apreHi = this._leafCount; var fadeCount:Number = 25; for (var i:Number = 1; i <= this._leafCount; i++) { if (i == this.leafNodeItr) { this.throbber["leaf" + i]._alpha = 100; } else if ( i > preLo && i <= preHi ) { this.throbber["leaf" + i]._alpha = 25 + (Math.round(75 / this._trailCount) * (i - preLo - (apreLo - this._leafCount))); } else if ( i > apreLo && i <= apreHi ) { this.throbber["leaf" + i]._alpha = 25 + (Math.round(75 / this._trailCount) * (i - (this._leafCount - (preLo - (apreLo - this._leafCount))))); } else { this.throbber["leaf" + i]._alpha = 25; } } this.leafNodeItr++; } ), Math.round(this._cycleSpeed / this._leafCount)); } function drawLeafStub (target:MovieClip, x:Number, y:Number) { target.lineStyle(this._leafSize, this._color, 100); target.moveTo(x, y); target.lineTo(x*1.5, y*1.5); } function drawLeafCircle (target:MovieClip, x:Number, y:Number) { var w = this._leafSize; var h = this._leafSize; // center the circle w /= 2; h /= 2; x += w; y += h; var xc1 = w*(Math.SQRT2-1), xc2 = w*(Math.SQRT2/2); var yc1 = h*(Math.SQRT2-1), yc2 = h*(Math.SQRT2/2); target.lineStyle(0, this._color, 100); target.beginFill(this._color); target.moveTo(x+w, y); target.curveTo(x+w, y+yc1, x+xc2, y+yc2); target.curveTo(x+xc1, y+h, x, y+h); target.curveTo(x-xc1, y+h, x-xc2, y+yc2); target.curveTo(x-w, y+yc1, x-w, y); target.curveTo(x-w, y-yc1, x-xc2, y-yc2); target.curveTo(x-xc1, y-h, x, y-h); target.curveTo(x+xc1, y-h, x+xc2, y-yc2); target.curveTo(x+w, y-yc1, x+w, y); target.endFill(); } function _close () { clearInterval(this.interval); this.removeMovieClip(); } }