home *** CD-ROM | disk | FTP | other *** search
- class LRG.LRGAnimationAction extends LRG.LRGAction
- {
- var m_sActionType;
- var m_pFrameList;
- var m_sName;
- var m_fDirection;
- var m_fCurrentFrameIndex;
- var m_bIsLooping;
- var m_fFPS;
- function LRGAnimationAction(kAnimationParams)
- {
- super();
- this.init(kAnimationParams);
- }
- function init(kAnimationParams)
- {
- if(kAnimationParams.m_sType == undefined && (this.m_sActionType == undefined || this.m_sActionType == "DEFAULT"))
- {
- kAnimationParams.m_sType = "FRAME_ANIMATION";
- }
- super.init(kAnimationParams);
- if(kAnimationParams.m_fStartFrame != undefined && kAnimationParams.m_fEndFrame != undefined)
- {
- if(this.m_pFrameList == undefined)
- {
- this.m_pFrameList = new Array();
- }
- this.m_pFrameList.splice(0);
- var _loc3_ = kAnimationParams.m_fStartFrame;
- while(_loc3_ <= kAnimationParams.m_fEndFrame)
- {
- this.m_pFrameList.push(_loc3_);
- _loc3_ = _loc3_ + 1;
- }
- }
- else if(kAnimationParams.m_pFrameList != undefined)
- {
- delete this.m_pFrameList;
- this.m_pFrameList = kAnimationParams.m_pFrameList.slice(0);
- }
- else if(this.m_pFrameList == undefined)
- {
- trace("Animation action " + this.m_sName + " specified with no frame list.");
- }
- if(kAnimationParams.m_fDirection != undefined)
- {
- this.m_fDirection = kAnimationParams.m_fDirection;
- }
- else if(this.m_fDirection == undefined)
- {
- this.m_fDirection = 1;
- }
- this.m_fCurrentFrameIndex = 0;
- if(kAnimationParams.m_bLoop != undefined)
- {
- this.m_bIsLooping = kAnimationParams.m_bLoop;
- }
- else if(this.m_bIsLooping == undefined)
- {
- this.m_bIsLooping = false;
- }
- }
- function reset(fCurrTime, kAnimationParams)
- {
- super.reset(fCurrTime,kAnimationParams);
- if(this.m_fDirection > 0)
- {
- this.m_fCurrentFrameIndex = 0;
- }
- else
- {
- this.m_fCurrentFrameIndex = this.m_pFrameList.length - 1;
- }
- }
- function doUpdate(fCurrTime, fDeltaTimeSecs, kClip)
- {
- var _loc3_ = fDeltaTimeSecs * this.m_fFPS;
- this.m_fCurrentFrameIndex += this.m_fDirection * _loc3_;
- var _loc4_ = Math.round(this.m_fCurrentFrameIndex);
- if(_loc4_ < this.m_pFrameList.length)
- {
- var _loc2_ = this.m_pFrameList[Math.round(this.m_fCurrentFrameIndex)];
- }
- else
- {
- _loc2_ = this.m_pFrameList[this.m_pFrameList.length - 1];
- }
- kClip.gotoAndStop(_loc2_);
- if(!this.m_bIsLooping)
- {
- if(this.m_fCurrentFrameIndex < 0 || this.m_fCurrentFrameIndex >= this.m_pFrameList.length)
- {
- return true;
- }
- }
- else if(this.m_fCurrentFrameIndex < 0)
- {
- this.m_fCurrentFrameIndex = this.m_pFrameList.length - 1;
- }
- else if(this.m_fCurrentFrameIndex >= this.m_pFrameList.length)
- {
- this.m_fCurrentFrameIndex = 0;
- }
- return false;
- }
- }
-