home *** CD-ROM | disk | FTP | other *** search
- class LRG.LRGMovieClip extends MovieClip
- {
- var m_kActionsList;
- var m_pActiveActions;
- var m_kClipClock;
- var onEnterFrame;
- function LRGMovieClip()
- {
- super();
- if(this._name == "m_kUpsellBackground")
- {
- trace("created a m_kUpsellBackground");
- }
- this.stop();
- this.init();
- }
- function init()
- {
- this.m_kActionsList = new Object();
- this.m_pActiveActions = new Array();
- this.m_kClipClock = undefined;
- }
- function setClock(kClockObject)
- {
- this.m_kClipClock = kClockObject;
- }
- function getClock()
- {
- return this.m_kClipClock;
- }
- function addAction(kActionObject)
- {
- if(this.m_kActionsList[kActionObject.getName()] != undefined)
- {
- this.removeAction(kActionObject.getName());
- }
- this.m_kActionsList[kActionObject.getName()] = kActionObject;
- }
- function removeAction(sActionKey)
- {
- if(this.m_kActionsList[sActionKey] != undefined)
- {
- if(this.m_pActiveActions.getIndex(sActionKey) != -1)
- {
- this.stopAction(sActionKey,false);
- }
- delete this.m_kActionsList[sActionKey];
- if(this.m_pActiveActions.length <= 0)
- {
- this.onEnterFrame = undefined;
- }
- }
- }
- function removeAllActions()
- {
- var _loc3_ = new Array();
- for(var _loc4_ in this.m_kActionsList)
- {
- _loc3_.push(_loc4_);
- }
- var _loc2_ = 0;
- while(_loc2_ < _loc3_.length)
- {
- this.removeAction(_loc3_[_loc2_]);
- _loc2_ = _loc2_ + 1;
- }
- false;
- }
- function startAction(sActionKey, kActionParams, bExclusiveType)
- {
- if(sActionKey == "THROB_IN")
- {
- trace("starting THROB_IN");
- }
- var _loc3_ = undefined;
- if((_loc3_ = this.m_kActionsList[sActionKey]) == undefined)
- {
- trace(this + ": An attempt was made to start the undefined action " + sActionKey);
- return undefined;
- }
- if(this.m_pActiveActions.getIndex(sActionKey) != -1)
- {
- return undefined;
- }
- if(bExclusiveType)
- {
- this.stopActionsOfType(_loc3_.getType());
- }
- _loc3_.reset(this.getClipTime(),kActionParams);
- this.m_pActiveActions.push(sActionKey);
- if(sActionKey == "THROB_IN")
- {
- trace("pushed " + this.m_pActiveActions);
- }
- this.onEnterFrame = this.LRGOnEnterFrame;
- }
- function stopActionsOfType(sActionType)
- {
- var _loc5_ = this.m_pActiveActions.slice(0);
- var _loc2_ = 0;
- while(_loc2_ < _loc5_.length)
- {
- var _loc3_ = _loc5_[_loc2_];
- var _loc4_ = this.m_kActionsList[_loc3_];
- if(_loc4_.getType() == sActionType)
- {
- this.stopAction(_loc3_,false);
- }
- _loc2_ = _loc2_ + 1;
- }
- false;
- }
- function stopAction(sActionKey, bCompleted)
- {
- var _loc2_ = this.m_pActiveActions.removeData(sActionKey);
- delete this.m_pActiveActions;
- this.m_pActiveActions = _loc2_;
- if(!this.isActionActive())
- {
- this.onEnterFrame = undefined;
- }
- if(bCompleted)
- {
- this.onActionCompleted(sActionKey);
- }
- }
- function stopAllActions()
- {
- var _loc3_ = this.m_pActiveActions.slice(0);
- var _loc2_ = 0;
- while(_loc2_ < _loc3_.length)
- {
- this.stopAction(_loc3_[_loc2_],false);
- _loc2_ = _loc2_ + 1;
- }
- false;
- }
- function getActionsList()
- {
- return this.m_kActionsList;
- }
- function getActiveActions()
- {
- return this.m_pActiveActions;
- }
- function getAction(sActionKey)
- {
- return this.m_kActionsList[sActionKey];
- }
- function isActionActive()
- {
- return this.m_pActiveActions.length >= 1;
- }
- function playAnimation(sName, fFps, fStartFrame, fEndFrame, bLoop, fDirection)
- {
- var _loc2_ = new Object();
- _loc2_.m_sName = sName;
- _loc2_.m_fFPS = fFps;
- _loc2_.m_fStartFrame = fStartFrame;
- _loc2_.m_fEndFrame = fEndFrame;
- _loc2_.m_bLoop = bLoop;
- _loc2_.m_fDirection = fDirection;
- var _loc3_ = new LRG.LRGAnimationAction(_loc2_);
- this.addAction(_loc3_);
- this.startAction(sName,null,true);
- }
- function play(fFps, bLoop)
- {
- if(this._name == "m_kAnimation")
- {
- trace("LRGMovieclip play for mk animation");
- }
- if(fFps == undefined)
- {
- fFps = 30;
- }
- if(bLoop == undefined)
- {
- bLoop = false;
- }
- this.playAnimation("DEFAULT_FULL_FRAME_ANIMATION",fFps,1,this._totalframes,bLoop,1);
- }
- function LRGOnEnterFrame()
- {
- if(this.isClockRunning())
- {
- this.LRGUpdateActions();
- this.doEnterFrame();
- }
- }
- function LRGUpdateActions()
- {
- var _loc8_ = this.getClipTime();
- var _loc5_ = new Array();
- var _loc6_ = new Array();
- var _loc4_ = undefined;
- var _loc3_ = 0;
- while(_loc3_ < this.m_pActiveActions.length)
- {
- _loc4_ = this.m_pActiveActions[_loc3_];
- var _loc7_ = this.m_kActionsList[_loc4_].update(_loc8_,this);
- if(_loc7_)
- {
- _loc5_.push(_loc4_);
- var _loc2_ = this.m_kActionsList[_loc4_].getNext();
- if(_loc2_ != undefined && this.m_kActionsList[_loc2_] != undefined)
- {
- _loc6_.push(_loc2_);
- }
- }
- _loc3_ = _loc3_ + 1;
- }
- _loc3_ = 0;
- while(_loc3_ < _loc5_.length)
- {
- this.stopAction(_loc5_[_loc3_],true);
- _loc3_ = _loc3_ + 1;
- }
- false;
- _loc3_ = 0;
- while(_loc3_ < _loc6_.length)
- {
- this.startAction(_loc6_[_loc3_]);
- _loc3_ = _loc3_ + 1;
- }
- false;
- }
- function onActionCompleted(sActionKey)
- {
- this._parent.onActionCompleted(sActionKey);
- }
- function doEnterFrame()
- {
- }
- function getClipTime()
- {
- if(this.m_kClipClock)
- {
- return this.m_kClipClock.getTime();
- }
- return getTimer() / 1000;
- }
- function isClockRunning()
- {
- if(!this.m_kClipClock)
- {
- return true;
- }
- return this.m_kClipClock.isRunning();
- }
- }
-