home *** CD-ROM | disk | FTP | other *** search
- class Common
- {
- var mClip_bmp;
- var bmpRoot;
- var removeMovieClip;
- var nTime;
- var ready;
- var nTemp;
- var nT;
- var nRdm;
- var m_0;
- var m_1;
- var finish;
- var onEnterFrame;
- var nRdm_2;
- var m_2;
- var m_3;
- var nTemp_time;
- var _alpha;
- var nN;
- static var a2r = 57.29577951308232;
- function Common()
- {
- }
- static function enabledFor(_b, _m, _mHit, _nDepth)
- {
- _m == undefined && (_m = _root);
- _mHit == undefined && (_mHit = _root);
- _nDepth == undefined && (_nDepth = _m.getNextHighestDepth());
- if(_b)
- {
- _m.createEmptyMovieClip("mEnabled",_nDepth);
- _m.mEnabled.enabled = false;
- _m.mEnabled.hitArea = _mHit;
- _m.mEnabled.onPress = function()
- {
- };
- updateAfterEvent();
- }
- else
- {
- _m.mEnabled.removeMovieClip();
- updateAfterEvent();
- }
- }
- static function changeQ()
- {
- switch(_root._quality)
- {
- case "LOW":
- _root._quality = "MEDIUM";
- return "MED";
- case "MEDIUM":
- _root._quality = "HIGH";
- break;
- case "HIGH":
- _root._quality = "BEST";
- break;
- case "BEST":
- _root._quality = "LOW";
- }
- return _root._quality;
- }
- static function mask()
- {
- var bmpRoot = new flash.display.BitmapData(Stage.width,Stage.height,false,0);
- bmpRoot.draw(_root);
- var _loc3_ = _root.createEmptyMovieClip("mClip_mask",_root.getNextHighestDepth());
- var mClip_bmp = _root.createEmptyMovieClip("mClip_bmp",_root.getNextHighestDepth());
- mClip_bmp.attachBitmap(bmpRoot,0);
- _loc3_.bmpRoot = bmpRoot;
- _loc3_.mClip_bmp = mClip_bmp;
- _loc3_.nTime = 0;
- _loc3_.nT = 20;
- _loc3_.ready = function()
- {
- this.mClip_bmp.setMask(this);
- Common.enabledFor(true);
- };
- _loc3_.finish = function()
- {
- this.mClip_bmp.removeMovieClip();
- this.bmpRoot.dispose();
- Common.enabledFor(false);
- this.removeMovieClip();
- };
- switch(random(4))
- {
- case 0:
- _loc3_.nRdm = random(2);
- Common.createClip("m_",_loc3_,0,0);
- Common.createClip("m_",_loc3_,0,1,{_x:10,_y:10,_rotation:180});
- _loc3_.onEnterFrame = function()
- {
- if(this.nTime == 0)
- {
- this.ready();
- }
- this.nTime = this.nTime + 1;
- this.nTemp = 50 - Common.unlinearCycle(this.nTime,this.nT,50);
- if(this.nRdm > 0)
- {
- this.m_0._yscale = this.m_1._yscale = this.nTemp;
- }
- else
- {
- this.m_0._xscale = this.m_1._xscale = this.nTemp;
- }
- if(this.nTime == this.nT / 2)
- {
- this.finish();
- delete this.onEnterFrame;
- }
- };
- break;
- case 1:
- _loc3_.nRdm = random(3);
- _loc3_.nRdm_2 = random(4);
- Common.createClip("m_",_loc3_,1,0,{_x:5,_y:5});
- _loc3_.onEnterFrame = function()
- {
- if(this.nTime == 0)
- {
- this.ready();
- }
- this.nTime = this.nTime + 1;
- this.nTemp = 100 - Common.unlinearCycle(this.nTime,this.nT,100);
- switch(this.nRdm)
- {
- case 0:
- this.m_0._xscale = 150;
- this.m_0._yscale = this.nTemp;
- break;
- case 1:
- this.m_0._xscale = this.nTemp;
- this.m_0._yscale = 150;
- break;
- case 2:
- this.m_0._yscale = _loc0_ = this.nTemp;
- this.m_0._xscale = _loc0_;
- }
- if(this.nRdm_2 == 3)
- {
- this.m_0._rotation = 180 - Common.unlinearCycle(this.nTime,this.nT,180);
- }
- else if(this.nRdm_2 == 2)
- {
- this.m_0._rotation = Common.unlinearCycle(this.nTime,this.nT,180);
- }
- if(this.nTime == this.nT / 2)
- {
- this.finish();
- delete this.onEnterFrame;
- }
- };
- break;
- case 2:
- _loc3_.nRdm = random(5);
- Common.createClip("m_",_loc3_,2,0);
- Common.createClip("m_",_loc3_,2,1,{_x:10,_y:10,_rotation:180});
- _loc3_.onEnterFrame = function()
- {
- if(this.nTime == 0)
- {
- this.ready();
- }
- this.nTime = this.nTime + 1;
- this.nTemp = 100 - Common.unlinearCycle(this.nTime,this.nT,100);
- switch(this.nRdm)
- {
- case 0:
- this.m_1._yscale = _loc0_ = this.nTemp;
- this.m_0._yscale = _loc0_;
- break;
- case 1:
- this.m_1._yscale = _loc0_ = this.nTemp;
- this.m_0._xscale = _loc0_;
- break;
- case 2:
- this.m_1._xscale = _loc0_ = this.nTemp;
- this.m_0._yscale = _loc0_;
- break;
- case 3:
- this.m_1._xscale = _loc0_ = this.nTemp;
- this.m_0._xscale = _loc0_;
- break;
- case 4:
- this.m_1._xscale = _loc0_ = this.nTemp;
- this.m_0._xscale = _loc0_;
- this.m_1._yscale = _loc0_ = this.nTemp;
- this.m_0._yscale = _loc0_;
- }
- if(this.nTime == this.nT / 2)
- {
- this.finish();
- delete this.onEnterFrame;
- }
- };
- break;
- case 3:
- _loc3_.nRdm = random(2);
- Common.createClip("m_",_loc3_,2,0);
- Common.createClip("m_",_loc3_,2,1,{_x:10,_y:10,_rotation:180});
- Common.createClip("m_",_loc3_,2,2,{_x:0,_y:10,_rotation:-90});
- Common.createClip("m_",_loc3_,2,3,{_x:10,_y:0,_rotation:90});
- _loc3_.onEnterFrame = function()
- {
- if(this.nTime == 0)
- {
- this.ready();
- }
- this.nTime = this.nTime + 1;
- this.nTemp = 100 - Common.unlinearCycle(this.nTime,this.nT,100);
- if(this.nRdm > 0)
- {
- this.m_0._yscale = this.m_1._yscale = this.m_2._yscale = this.m_3._yscale = this.nTemp;
- }
- else
- {
- this.m_0._xscale = this.m_1._xscale = this.m_2._xscale = this.m_3._xscale = this.nTemp;
- }
- if(this.nTime == this.nT / 2)
- {
- this.finish();
- delete this.onEnterFrame;
- }
- };
- }
- _loc3_._width = _loc0_ = Stage.width;
- _loc0_;
- _loc3_._height = _loc0_ = Stage.height;
- _loc0_;
- }
- static function getBmdHitRect(bg, obj)
- {
- var _loc2_ = Common.getContainBmd(bg,obj,10,10);
- _root.attachBitmap(_loc2_,0);
- return _loc2_.getColorBoundsRect(4294967295,4278190080);
- }
- static function getContainBmd(bg, obj, bm1, bm2)
- {
- var _loc1_ = obj.getBounds(obj);
- var _loc3_ = new flash.geom.Rectangle(_loc1_.xMin,_loc1_.yMin,_loc1_.xMax - _loc1_.xMin,_loc1_.yMax - _loc1_.yMin);
- var _loc4_ = new flash.display.BitmapData(_loc3_.width,_loc3_.height,true,0);
- var _loc6_ = bg.transform.concatenatedMatrix;
- var _loc2_ = new flash.geom.Matrix(1,0,0,1,- _loc3_.x,- _loc3_.y);
- _loc4_.draw(obj,_loc2_,null,bm1);
- _loc2_.tx *= -1;
- _loc2_.ty *= -1;
- var _loc7_ = obj.transform.concatenatedMatrix;
- _loc2_.concat(_loc7_);
- _loc2_.invert();
- _loc6_.concat(_loc2_);
- _loc4_.draw(bg,_loc6_,null,bm2);
- return _loc4_;
- }
- static function createClip(_s, _m, _nType, _nDepth, _ob)
- {
- _nDepth == undefined && (_nDepth = _m.getNextHighestDepth());
- _nType == undefined && (_nType = 0);
- _m.createEmptyMovieClip(_s + _nDepth,_nDepth);
- _m[_s + _nDepth].beginFill(0);
- switch(_nType)
- {
- case 0:
- _m[_s + _nDepth].lineTo(10,0);
- _m[_s + _nDepth].lineTo(10,10);
- _m[_s + _nDepth].lineTo(0,10);
- _m[_s + _nDepth].lineTo(0,0);
- break;
- case 1:
- _m[_s + _nDepth].moveTo(-5,-5);
- _m[_s + _nDepth].lineTo(-5,5);
- _m[_s + _nDepth].lineTo(5,5);
- _m[_s + _nDepth].lineTo(5,-5);
- _m[_s + _nDepth].lineTo(-5,-5);
- break;
- case 2:
- _m[_s + _nDepth].lineTo(10,0);
- _m[_s + _nDepth].lineTo(0,10);
- _m[_s + _nDepth].lineTo(0,0);
- }
- _m[_s + _nDepth].endFill();
- for(var _loc5_ in _ob)
- {
- _m[_s + _nDepth][_loc5_] = _ob[_loc5_];
- }
- return _m[_s + _nDepth];
- }
- static function wink(_m, _T, _n)
- {
- _m.nTemp_time = 0;
- _m.nT = _T;
- _m.nN = _n;
- _m.onEnterFrame = function()
- {
- this.nTemp_time = this.nTemp_time + 1;
- this._alpha = 100 - Common.unlinearCycle(this.nTemp_time,this.nT,100);
- if(this.nTemp_time >= this.nN * this.nT)
- {
- this._alpha = 100;
- delete this.onEnterFrame;
- delete this.nTemp_time;
- delete this.nN;
- delete this.nT;
- }
- };
- }
- static function addClip(_sId, _sName, _m, oBject, _nDepth)
- {
- _nDepth == undefined && (_nDepth = _m.getNextHighestDepth());
- _sName == undefined && (_sName = _sId);
- return _m.attachMovie(_sId,_sName + _nDepth,_nDepth,oBject);
- }
- static function clearAllClip(_m, _bAll)
- {
- for(var _loc3_ in _m)
- {
- if(_bAll)
- {
- _m[_loc3_].swapDepths(0);
- }
- _m[_loc3_].removeMovieClip();
- }
- }
- static function removeFixMc(mc)
- {
- mc.swapDepths(mc._parent.getNextHighestDepth());
- mc.removeMovieClip();
- }
- static function coordinateConvert(mc1, mc2, x, y)
- {
- var _loc2_ = new Object({x:(x == undefined ? 0 : x),y:(y == undefined ? 0 : y)});
- mc1.localToGlobal(_loc2_);
- if(mc2 != undefined && mc2 != _root)
- {
- mc2.globalToLocal(_loc2_);
- }
- return _loc2_;
- }
- static function localToLocal(p, mc1, mc2)
- {
- mc1.localToGlobal(p);
- mc2.globalToLocal(p);
- }
- static function np(_n)
- {
- _n == undefined && (_n = 1);
- return random(2) <= 0 ? - _n : _n;
- }
- static function rdm_2(a, b)
- {
- return Math.random() * (b - a) + a;
- }
- static function rdm_0(a, l)
- {
- return a - Math.random() * l + l / 2;
- }
- static function rdm_a(a1, a2, A)
- {
- var _loc3_ = 0;
- var _loc5_ = Math.random();
- var _loc4_ = 0;
- var _loc2_ = A.concat();
- for(var _loc6_ in _loc2_)
- {
- var _loc1_ = 0;
- while(_loc1_ < Number(_loc6_))
- {
- _loc2_[_loc6_] += _loc2_[_loc1_];
- _loc1_ = _loc1_ + 1;
- }
- _loc3_ < _loc2_[_loc6_] && (_loc3_ = _loc2_[_loc6_]);
- _loc2_[_loc6_] /= _loc3_;
- if(_loc5_ >= _loc2_[_loc6_])
- {
- _loc4_ = Number(_loc6_) + 1;
- break;
- }
- }
- return a1 + _loc4_ * (a2 - a1) / (_loc2_.length - 1);
- }
- static function equal(_ob1, _ob2)
- {
- for(var _loc3_ in _ob1)
- {
- if(_ob1[_loc3_] != _ob2[_loc3_])
- {
- return false;
- }
- }
- return true;
- }
- static function formatNumber(_n, _d, _nMin, _nMax)
- {
- _n += _d;
- if(_n < _nMin)
- {
- _n = _nMin;
- }
- else if(_n > _nMax)
- {
- _n = _nMax;
- }
- return _n;
- }
- static function disorder(arr)
- {
- var _loc5_ = arr.length;
- var _loc1_ = 0;
- while(_loc1_ < _loc5_)
- {
- var _loc3_ = random(_loc5_);
- var _loc4_ = arr[_loc1_];
- arr[_loc1_] = arr[_loc3_];
- arr[_loc3_] = _loc4_;
- _loc1_ = _loc1_ + 1;
- }
- }
- static function removeArray(_a, _ai)
- {
- for(var _loc2_ in _a)
- {
- if(_a[_loc2_] == _ai)
- {
- _a.splice(int(_loc2_),1);
- return -1;
- }
- }
- return _loc2_ != undefined ? 1 : 0;
- }
- static function forIn(_a, _s, _b, _ob)
- {
- var _loc2_ = [];
- for(var _loc5_ in _a)
- {
- if((_a[_loc5_] == undefined || !_a[_loc5_][_s](_ob)) && _b)
- {
- _loc2_.push(_loc5_);
- }
- }
- if(_b)
- {
- for(_loc5_ in _loc2_)
- {
- _a.splice(int(_loc2_[_loc5_]),1);
- }
- }
- }
- static function evaUndf(_ob, _ob_new)
- {
- if(_ob == undefined)
- {
- return _ob_new;
- }
- return _ob;
- }
- static function distance(x0, y0, xt, yt)
- {
- return Math.sqrt(Math.pow(xt - x0,2) + Math.pow(yt - y0,2));
- }
- static function side_min(x0, y0, xt, yt)
- {
- return Math.min(Math.abs(xt - x0),Math.abs(yt - y0));
- }
- static function side_max(x0, y0, xt, yt)
- {
- return Math.max(Math.abs(xt - x0),Math.abs(yt - y0));
- }
- static function rFloor(r)
- {
- if(r >= 3.141592653589793)
- {
- r -= 6.283185307179586;
- }
- if(r <= -3.141592653589793)
- {
- r += 6.283185307179586;
- }
- return r;
- }
- static function rFloor_n(r)
- {
- if(r >= 180)
- {
- r -= 360;
- }
- if(r <= -180)
- {
- r += 360;
- }
- return r;
- }
- static function s_b(n, a, b)
- {
- if(a < n && n < b)
- {
- return 0;
- }
- if(n <= a)
- {
- return -1;
- }
- return 1;
- }
- static function vpNum(_n, _t)
- {
- _t == undefined && (_t = 1);
- if(_n == 0)
- {
- return 0;
- }
- if(_n > 0)
- {
- return _t;
- }
- return - _t;
- }
- static function formatTime(_n)
- {
- var _loc3_ = undefined;
- var _loc4_ = undefined;
- var _loc2_ = undefined;
- if(_n < 60)
- {
- _loc4_ = _loc3_ = 0;
- _loc2_ = _n;
- }
- else if(_n < 3600)
- {
- _loc3_ = 0;
- _loc4_ = Math.floor(_n / 60);
- _loc2_ = _n % 60;
- }
- else
- {
- _loc3_ = Math.floor(_n / 3600);
- _loc4_ = Math.floor(_n / 60) % 60;
- _loc2_ = _n % 60;
- }
- var _loc5_ = _loc3_ >= 10 ? _loc3_ : "0" + _loc3_;
- var _loc7_ = _loc4_ >= 10 ? _loc4_ : "0" + _loc4_;
- var _loc6_ = _loc2_ >= 10 ? _loc2_ : "0" + _loc2_;
- return _loc5_ + ":" + _loc7_ + ":" + _loc6_;
- }
- static function unlinearCycle(x, T, r)
- {
- var _loc1_ = T / 2;
- var _loc2_ = (- r) / (_loc1_ * _loc1_);
- return _loc2_ * Math.pow(x % T - _loc1_,2) + r;
- }
- static function linearCycle(x, T, r)
- {
- var _loc1_ = T / 2;
- x %= T;
- if(x > _loc1_)
- {
- return (1 - x % _loc1_ / _loc1_) * r;
- }
- if(x < _loc1_)
- {
- return x % _loc1_ / _loc1_ * r;
- }
- return r;
- }
- static function getAngle(_m1, _m2)
- {
- if(_m1._parent == _m2._parent)
- {
- return Math.atan2(_m1._y - _m2._y,_m1._x - _m2._x);
- }
- }
- static function parabolaSpeed(x0, y0, xt, yt, nR, nG)
- {
- var _loc1_ = xt - x0;
- var _loc2_ = yt - y0;
- return Math.sqrt(nG * _loc1_ / (Math.tan(nR) - _loc2_ / _loc1_) / Math.pow(Math.cos(nR),2) / 2);
- }
- static function parabolaRot(x0, y0, xt, yt, nV, nG)
- {
- var _loc5_ = xt - x0;
- var _loc7_ = yt - y0;
- var _loc2_ = nG * _loc5_ * _loc5_ / (2 * nV * nV);
- var _loc1_ = _loc5_;
- var _loc6_ = _loc2_ - _loc7_;
- var _loc4_ = _loc1_ * _loc1_ - 4 * _loc2_ * _loc6_;
- if(_loc4_ < 0)
- {
- return undefined;
- }
- var _loc3_ = new Object();
- if(_loc5_ > 0)
- {
- _loc3_.x1 = Math.atan((- _loc1_ - Math.sqrt(_loc4_)) / (2 * _loc2_));
- _loc3_.x2 = Math.atan((- _loc1_ + Math.sqrt(_loc4_)) / (2 * _loc2_));
- }
- else
- {
- _loc3_.x1 = Math.atan((- _loc1_ - Math.sqrt(_loc4_)) / (2 * _loc2_)) - 3.141592653589793;
- _loc3_.x2 = Math.atan((- _loc1_ + Math.sqrt(_loc4_)) / (2 * _loc2_)) - 3.141592653589793;
- }
- return _loc3_;
- }
- static function deepObjectCopy(obj)
- {
- if(typeof obj != "object" || obj instanceof Button || obj instanceof TextField || obj instanceof MovieClip)
- {
- return obj;
- }
- var _loc3_ = undefined;
- if(obj instanceof Boolean)
- {
- _loc3_ = new Boolean(Boolean.prototype.valueOf.call(obj));
- }
- else if(obj instanceof Number)
- {
- _loc3_ = new Number(Number.prototype.valueOf.call(obj));
- }
- else if(obj instanceof String)
- {
- _loc3_ = new String(String.prototype.valueOf.call(obj));
- }
- else if(obj.__constructor__)
- {
- if(typeof obj.clone == "function")
- {
- _loc3_ = obj.clone();
- if(_loc3_.__proto__ == obj.__proto__)
- {
- return _loc3_;
- }
- }
- _loc3_ = new obj.__constructor__();
- }
- else if(obj instanceof Array)
- {
- _loc3_ = [];
- }
- else
- {
- _loc3_ = {};
- }
- for(var _loc4_ in obj)
- {
- if(obj.hasOwnProperty(_loc4_))
- {
- _loc3_[_loc4_] = arguments.callee(obj[_loc4_]);
- }
- }
- return _loc3_;
- }
- }
-