home *** CD-ROM | disk | FTP | other *** search
- class Exp
- {
- var mc;
- var mHit;
- var totalPiece;
- var onEnterFrame;
- var exp;
- var _rotation;
- var va;
- var vx;
- var vy;
- var x;
- var y;
- var vz;
- var g;
- var z;
- var localToGlobal;
- var _parent;
- var _alpha;
- var removeMovieClip;
- var xyObj;
- var _x;
- var _y;
- var onFinish;
- function Exp(_mc, _m2)
- {
- this.mc = _mc;
- this.mHit = _m2;
- this.mc.filters = null;
- this.mc.exp = this;
- this.mc._rotation = 0;
- this.totalPiece = 0;
- this.mc.stop();
- this.mc.onEnterFrame = function()
- {
- delete this.onEnterFrame;
- this.exp.init();
- };
- }
- function init(Void)
- {
- var _loc2_ = undefined;
- var _loc4_ = 1;
- for(var _loc5_ in this.mc)
- {
- _loc2_ = this.mc[_loc5_];
- if(_loc2_._parent == this.mc)
- {
- this.totalPiece = this.totalPiece + 1;
- _loc4_;
- _loc2_.swapDepths(_loc4_++);
- _loc2_.x = 0.1 * _loc2_._y + (Math.random() - 0.5) * 7;
- _loc2_.y = 0.1 * _loc2_._x + (Math.random() - 0.5) * 7;
- _loc2_.z = 0;
- _loc2_.vx = _loc2_.x;
- _loc2_.vy = _loc2_.y;
- _loc2_.vz = 20 * (Math.random() + 0.5);
- _loc2_.va = 10 - Math.random() * 21;
- _loc2_.g = -2;
- _loc2_.onEnterFrame = function()
- {
- this._rotation += this.va;
- this.vx *= 0.95;
- this.vy *= 0.95;
- this.x += this.vx;
- this.y += this.vy;
- this.vz += this.g;
- this.z += this.vz;
- var _loc2_ = {x:_X,y:_Y};
- this.localToGlobal(_loc2_);
- if(this._parent.exp.mHit.hitTest(_loc2_.x,_loc2_.y,true))
- {
- this.z = 0;
- this.vz *= -0.2;
- this._alpha -= 40;
- if(this._alpha <= 0)
- {
- this._parent.exp.delPiece();
- this.removeMovieClip();
- }
- }
- this.xyObj = Exp.getXY(this.x,this.y,this.z);
- this._x = this.xyObj._x;
- this._y = this.xyObj._y;
- };
- }
- }
- }
- function delPiece(Void)
- {
- if(--this.totalPiece <= 0)
- {
- this.mc.swapDepths(0);
- this.mc._parent.removeMovieClip();
- this.onFinish();
- }
- }
- static function getXY(x, y, z)
- {
- return {_x:x,_y:- z};
- }
- }
-