home *** CD-ROM | disk | FTP | other *** search
/ The Great Adventure of Natural Gas / start / start.swf / scripts / frame_2 / DoAction.as < prev   
Encoding:
Text File  |  2007-01-01  |  2.0 KB  |  87 lines

  1. MovieClip.prototype.transAlpha = function(fin, accel, callback)
  2. {
  3.    var _loc1_ = this;
  4.    _loc1_.createEmptyMovieClip("mcAlpha",8426);
  5.    var o = _loc1_;
  6.    _loc1_.mcAlpha.onEnterFrame = function()
  7.    {
  8.       var _loc1_ = fin - o._alpha;
  9.       if(Math.abs(_loc1_) <= 2)
  10.       {
  11.          o._alpha = fin;
  12.          this.removeMovieClip();
  13.          callback();
  14.       }
  15.       else
  16.       {
  17.          o._alpha = Math.round(o._alpha + _loc1_ / accel) + 1;
  18.       }
  19.    };
  20. };
  21. showToolTip = function(contenu)
  22. {
  23.    i = 1;
  24.    startTime = getTimer();
  25.    this.attachMovie("tooltyp","tooltyp",600);
  26.    tooltyp._visible = false;
  27.    if(_xmouse < 260)
  28.    {
  29.       var _loc1_ = 10;
  30.    }
  31.    else
  32.    {
  33.       _loc1_ = - tooltyp._width - 10;
  34.    }
  35.    tooltyp._y = _ymouse - 20;
  36.    tooltyp._x = _xmouse + _loc1_;
  37.    tooltyp.chtexte.background = true;
  38.    tooltyp.chtexte.backgroundColor = 16777215;
  39.    tooltyp.chtexte.border = true;
  40.    tooltyp.chtexte.borderColor = 0;
  41.    tooltyp.chtexte.text = contenu;
  42.    longeur = tooltyp.chtexte.textWidth;
  43.    tooltyp.onEnterFrame = function()
  44.    {
  45.       curentTime = getTimer() - startTime;
  46.       tooltyp.chtexte._width = 20 * i++;
  47.       if(tooltyp.chtexte._width > longeur)
  48.       {
  49.          tooltyp.chtexte._width = longeur + 10;
  50.       }
  51.       if(curentTime > 500)
  52.       {
  53.          tooltyp._visible = true;
  54.          tooltyp.transAlpha(100,3);
  55.       }
  56.       if(_xmouse < 260)
  57.       {
  58.          var _loc1_ = 10;
  59.       }
  60.       else
  61.       {
  62.          _loc1_ = - tooltyp._width - 10;
  63.       }
  64.       tooltyp._y = _ymouse - 20;
  65.       tooltyp._x = _xmouse + _loc1_;
  66.    };
  67. };
  68. hideToolTip = function()
  69. {
  70.    tooltyp.removeMovieClip();
  71.    delete tooltyp.onEnterFrame;
  72.    tooltyp.transAlpha(0,2);
  73.    tooltyp.texte = "";
  74.    tooltyp.chtexte._width = 10;
  75. };
  76. _global.setToolTip = function(obj, s)
  77. {
  78.    obj.onRollOver = function()
  79.    {
  80.       showToolTip(s);
  81.    };
  82.    obj.onRollOut = function()
  83.    {
  84.       hideToolTip("");
  85.    };
  86. };
  87.