home *** CD-ROM | disk | FTP | other *** search
/ 600 Games / 600games.iso / Corrida / dragracer.swf / scripts / DefineSprite_430 / frame_1 / DoAction.as
Encoding:
Text File  |  2005-10-06  |  613 b   |  39 lines

  1. top = vol._y;
  2. left = vol._x;
  3. right = vol._x;
  4. bottom = vol._y + 100;
  5. vol.onPress = function()
  6. {
  7.    startDrag("vol",0,left,top,right,bottom);
  8.    dragging = true;
  9. };
  10. vol.onRelease = function()
  11. {
  12.    stopDrag();
  13.    dragging = false;
  14. };
  15. vol.onReleaseOutside = function()
  16. {
  17.    dragging = false;
  18. };
  19. this.onEnterFrame = function()
  20. {
  21.    if(dragging)
  22.    {
  23.       level = 100 - (vol._y - top);
  24.    }
  25.    else if(level > 100)
  26.    {
  27.       level = 100;
  28.    }
  29.    else if(level < 0)
  30.    {
  31.       level = 0;
  32.    }
  33.    else
  34.    {
  35.       vol._y = - level + 100 + top;
  36.    }
  37.    value = 0.5 + level / 100;
  38. };
  39.