home *** CD-ROM | disk | FTP | other *** search
/ Geek Games #12 / GEGA012.iso / eroticos / spankthebooty.swf / scripts / __Packages / Hand.as < prev    next >
Text File  |  2005-10-13  |  2KB  |  74 lines

  1. class Hand extends MovieClip
  2. {
  3.    var dragging = false;
  4.    var oldx = 0;
  5.    var oldy = 0;
  6.    var oldt = 0;
  7.    function Hand()
  8.    {
  9.       var _loc1_ = this;
  10.       super();
  11.       _loc1_.startx = _loc1_._x;
  12.       _loc1_.starty = _loc1_._y;
  13.       _loc1_.setFrame();
  14.    }
  15.    function show()
  16.    {
  17.       var _loc1_ = this;
  18.       _loc1_._x = _loc1_.startx;
  19.       _loc1_._y = _loc1_.starty;
  20.       _loc1_.setFrame();
  21.       _loc1_._visible = true;
  22.    }
  23.    function hide()
  24.    {
  25.       this._visible = false;
  26.    }
  27.    function onPress()
  28.    {
  29.       var _loc1_ = this;
  30.       _loc1_.dragging = true;
  31.       _loc1_.oldx = _loc1_._x = _loc1_._parent._xmouse;
  32.       _loc1_.oldy = _loc1_._y = _loc1_._parent._ymouse;
  33.       _loc1_.oldt = getTimer();
  34.    }
  35.    function onRelease()
  36.    {
  37.       var _loc1_ = this;
  38.       _loc1_.dragging = false;
  39.       _loc1_._x = Math.min(Math.max(_loc1_._x,-350),350);
  40.       _loc1_._y = Math.min(Math.max(_loc1_._y,-175),175);
  41.    }
  42.    function onEnterFrame()
  43.    {
  44.       var _loc1_ = this;
  45.       if(_loc1_.dragging)
  46.       {
  47.          var x = _loc1_._x = _loc1_._parent._xmouse;
  48.          var y = _loc1_._y = _loc1_._parent._ymouse;
  49.          var _loc3_ = getTimer();
  50.          var _loc2_ = 33 * Math.sqrt(Math.pow(x - _loc1_.oldx,2) + Math.pow(y - _loc1_.oldy,2)) / (_loc3_ - _loc1_.oldt);
  51.          _loc1_.oldx = x;
  52.          _loc1_.oldy = y;
  53.          _loc1_.oldt = _loc3_;
  54.          _loc1_.setFrame();
  55.          _loc1_._parent.console_mc.setSpeed(_loc2_);
  56.          if(_loc2_ > 100)
  57.          {
  58.             SoundManager.swing();
  59.          }
  60.          if(_loc1_.hitTest(_loc1_._parent.hitarea_mc))
  61.          {
  62.             _loc1_.onRelease();
  63.             _loc1_._parent.wak(_loc2_);
  64.          }
  65.       }
  66.    }
  67.    function setFrame()
  68.    {
  69.       var _loc1_ = 5 + Math.ceil(this._x / 60);
  70.       _loc1_ = Math.min(Math.max(_loc1_,2),11);
  71.       this.gotoAndStop(_loc1_);
  72.    }
  73. }
  74.