home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Acao / flameout.swf / scripts / __Packages / LRG / LRGFadeAction.as < prev    next >
Encoding:
Text File  |  2006-06-13  |  1.5 KB  |  59 lines

  1. class LRG.LRGFadeAction extends LRG.LRGAction
  2. {
  3.    var m_sActionType;
  4.    var m_bFadeIn;
  5.    var m_sName;
  6.    var m_fTimePassedSinceStart;
  7.    var m_fTotalActionTime;
  8.    function LRGFadeAction(kAnimationParams)
  9.    {
  10.       super();
  11.       this.init(kAnimationParams);
  12.    }
  13.    function init(kActionParams)
  14.    {
  15.       if(kActionParams.m_sType == undefined && (this.m_sActionType == undefined || this.m_sActionType == "DEFAULT"))
  16.       {
  17.          kActionParams.m_sType = "FADE";
  18.       }
  19.       super.init(kActionParams);
  20.       if(kActionParams.m_bFadeIn == undefined && this.m_bFadeIn == undefined)
  21.       {
  22.          this.m_bFadeIn = false;
  23.          trace("Fade action " + this.m_sName + " initialized without specified direction.");
  24.       }
  25.       else
  26.       {
  27.          this.m_bFadeIn = kActionParams.m_bFadeIn;
  28.       }
  29.       this.m_fTimePassedSinceStart = 0;
  30.    }
  31.    function reset(fCurrTime, kActionParams)
  32.    {
  33.       super.reset(fCurrTime,kActionParams);
  34.       this.m_fTimePassedSinceStart = 0;
  35.    }
  36.    function doUpdate(fCurrTime, fDeltaTimeSecs, kClip)
  37.    {
  38.       this.m_fTimePassedSinceStart += fDeltaTimeSecs;
  39.       var _loc2_ = this.m_fTimePassedSinceStart / this.m_fTotalActionTime;
  40.       if(_loc2_ > 1)
  41.       {
  42.          _loc2_ = 1;
  43.       }
  44.       if(this.m_bFadeIn)
  45.       {
  46.          kClip._alpha = _loc2_ * 100;
  47.       }
  48.       else
  49.       {
  50.          kClip._alpha = 100 - _loc2_ * 100;
  51.       }
  52.       if(_loc2_ == 1)
  53.       {
  54.          return true;
  55.       }
  56.       return false;
  57.    }
  58. }
  59.