home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 127 / MOBICLIC127.ISO / mac / DATA / DSS127 / DSS127_02 / DSS127_02.swf / scripts / frame_186 / DoAction.as
Text File  |  2010-09-13  |  4KB  |  127 lines

  1. function testSondes()
  2. {
  3.    if(countSondes == 4)
  4.    {
  5.       gotoAndStop("02_01_FIN_A");
  6.    }
  7.    else
  8.    {
  9.       gotoAndStop("AT_SONDE");
  10.    }
  11. }
  12. stop();
  13. if(countSondes == undefined)
  14. {
  15.    countSondes = 0;
  16. }
  17. nbDrags = 8;
  18. listCible = ["TERRE"];
  19. dragClip = "SONDE_01";
  20. var i = 1;
  21. while(i <= nbDrags)
  22. {
  23.    this[dragClip + "_" + gimme2digits(i)].pDrag = i;
  24.    this[dragClip + "_" + gimme2digits(i)].onRollOver = function()
  25.    {
  26.       this.useHandCursor = 0;
  27.       if(_root.drag == undefined)
  28.       {
  29.          this.useHandCursor = 1;
  30.          gereCursor(3);
  31.          joueBruitage({nomSon:"B_SONDE"});
  32.          this.gotoAndStop("E2");
  33.       }
  34.    };
  35.    this[dragClip + "_" + gimme2digits(i)].onRollOut = function()
  36.    {
  37.       if(_root.drag == undefined)
  38.       {
  39.          gereCursor(1);
  40.          stopBruitage({nomSon:"B_SONDE"});
  41.          this.gotoAndStop("E1");
  42.       }
  43.    };
  44.    this[dragClip + "_" + gimme2digits(i)].onPress = function()
  45.    {
  46.       if(_root.drag == undefined)
  47.       {
  48.          gereCursor(1);
  49.          this.gotoAndStop("E1");
  50.          _root.drag = this.pDrag;
  51.          this.origX = this._x;
  52.          this.origY = this._y;
  53.          this.diffX = _root._xmouse - this._x;
  54.          this.diffY = _root._ymouse - this._y;
  55.          this.origDepth = this.getDepth();
  56.          this.swapDepths(15050);
  57.          stopBruitage({nomSon:"B_SONDE"});
  58.          joueBruitage({nomSon:"B_DRAG"});
  59.       }
  60.    };
  61.    this[dragClip + "_" + gimme2digits(i)].onRelease = this[dragClip + "_" + gimme2digits(i)].onReleaseOutside = function()
  62.    {
  63.       this._x = this.origX;
  64.       this._y = this.origY;
  65.       this.swapDepths(this.origDepth);
  66.       if(_root.foundDrop == undefined)
  67.       {
  68.          joueBruitage({nomSon:"B_NO"});
  69.       }
  70.       else if(this.pDrag == 7)
  71.       {
  72.          joueSon({nomSon:"01_NO_B",actionFin:"RIEN"});
  73.       }
  74.       else if(this.pDrag == 8)
  75.       {
  76.          joueSon({nomSon:"01_NO_A",actionFin:"RIEN"});
  77.       }
  78.       else if(this.pDrag >= 5)
  79.       {
  80.          joueSon({nomSon:"01_NO_A",actionFin:"RIEN"});
  81.       }
  82.       else
  83.       {
  84.          _root.countSondes += 1;
  85.          this._visible = 0;
  86.          _root.gotoAndStop("01_" + gimme2digits(this.pDrag) + "_OK_A");
  87.       }
  88.       _root.drag = undefined;
  89.    };
  90.    this[dragClip + "_" + gimme2digits(i)].onEnterFrame = function()
  91.    {
  92.       if(_root.drag == this.pDrag)
  93.       {
  94.          this._x = _root._xmouse - this.diffX;
  95.          this._y = _root._ymouse - this.diffY;
  96.          if(this._x < CONTRAINT._x + this._width / 2)
  97.          {
  98.             this._x = CONTRAINT._x + this._width / 2;
  99.          }
  100.          else if(this._x > CONTRAINT._x + CONTRAINT._width - this._width / 2)
  101.          {
  102.             this._x = CONTRAINT._x + CONTRAINT._width - this._width / 2;
  103.          }
  104.          if(this._y < CONTRAINT._y + this._height / 2)
  105.          {
  106.             this._y = CONTRAINT._y + this._height / 2;
  107.          }
  108.          else if(this._y > CONTRAINT._y + CONTRAINT._height - this._height / 2)
  109.          {
  110.             this._y = CONTRAINT._y + CONTRAINT._height - this._height / 2;
  111.          }
  112.          _root.foundDrop = undefined;
  113.          var _loc3_ = 0;
  114.          while(_loc3_ < _root.listCible.length)
  115.          {
  116.             if(_root[_root.listCible[_loc3_]].hitTest(_root._xmouse,_root._ymouse,1))
  117.             {
  118.                trace("FOUND");
  119.                _root.foundDrop = _loc3_;
  120.             }
  121.             _loc3_ = _loc3_ + 1;
  122.          }
  123.       }
  124.    };
  125.    i++;
  126. }
  127.