home *** CD-ROM | disk | FTP | other *** search
/ 404 Jogos / CLJG.iso / Aventura / Tamus_on_Moonyland.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2008-09-09  |  1.1 KB  |  41 lines

  1. function cargando()
  2. {
  3.    var _loc4_ = undefined;
  4.    var _loc3_ = undefined;
  5.    var _loc2_ = undefined;
  6.    _loc4_ = _root.getBytesTotal();
  7.    _loc3_ = _root.getBytesLoaded();
  8.    _loc2_ = Math.floor(_loc3_ * 100 / _loc4_);
  9.    porcentaje_txt.text = _loc2_ + " %";
  10.    barra_mc.gotoAndStop(_loc2_);
  11.    if(_loc3_ == _loc4_)
  12.    {
  13.       clearInterval(hiloPrecarga);
  14.       play();
  15.    }
  16. }
  17. var hiloPrecarga = setInterval(cargando,1);
  18. stop();
  19. Mouse.hide();
  20. delay = 10;
  21. _root.attachMovie("mousep","mousep",_root.getNextHighestDepth());
  22. _root.attachMovie("mochithing","mochithing",_root.getNextHighestDepth());
  23. mousep.onEnterFrame = function()
  24. {
  25.    this._x = _root._xmouse;
  26.    this._y = _root._ymouse;
  27. };
  28. mochithing.onEnterFrame = function()
  29. {
  30.    dist_x = mousep._x - this._x;
  31.    dist_y = mousep._y - this._y;
  32.    distance = Math.sqrt(dist_x * dist_x + dist_y * dist_y);
  33.    angle = Math.atan2(dist_y,dist_x);
  34.    speed = distance / delay;
  35.    xspeed = speed * Math.cos(angle);
  36.    yspeed = speed * Math.sin(angle);
  37.    this._x += xspeed;
  38.    this._y += yspeed;
  39.    this._rotation = angle * 180 / 3.141592653589793;
  40. };
  41.