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

  1. function testDone()
  2. {
  3.    if(countDone == 2)
  4.    {
  5.       gotoAndStop("01_OK");
  6.    }
  7. }
  8. stop();
  9. if(_global.HOTE !== undefined)
  10. {
  11.    _global.HOTE.gListeVu_DSS127[0][0] = 1;
  12. }
  13. initBT_X();
  14. nbDrags = 2;
  15. countDone = 0;
  16. listCible = ["A","B"];
  17. dragClip = "ZONE_01";
  18. var i = 1;
  19. while(i <= nbDrags)
  20. {
  21.    this[dragClip + "_" + gimme2digits(i)].pDrag = i;
  22.    this[dragClip + "_" + gimme2digits(i)].pDone = undefined;
  23.    this[dragClip + "_" + gimme2digits(i)].onRollOver = function()
  24.    {
  25.       this.useHandCursor = 0;
  26.       if(this.pDone == undefined)
  27.       {
  28.          if(_root.drag == undefined)
  29.          {
  30.             this.useHandCursor = 1;
  31.             gereCursor(3);
  32.             this.gotoAndStop("E2");
  33.             joueBruitage({nomSon:"B_01_" + gimme2digits(this.pDrag) + "_ROLL"});
  34.          }
  35.       }
  36.    };
  37.    this[dragClip + "_" + gimme2digits(i)].onRollOut = function()
  38.    {
  39.       if(this.pDone == undefined)
  40.       {
  41.          if(_root.drag == undefined)
  42.          {
  43.             gereCursor(1);
  44.             this.gotoAndStop("E1");
  45.             stopBruitage({nomSon:"B_01_" + gimme2digits(this.pDrag) + "_ROLL"});
  46.          }
  47.       }
  48.    };
  49.    this[dragClip + "_" + gimme2digits(i)].onPress = function()
  50.    {
  51.       if(this.pDone == undefined)
  52.       {
  53.          stopBruitage({nomSon:"B_01_" + gimme2digits(this.pDrag) + "_ROLL"});
  54.          joueBruitage({nomSon:"B_01_" + gimme2digits(this.pDrag) + "_DRAG"});
  55.          if(_root.drag == undefined)
  56.          {
  57.             gereCursor(3);
  58.             this.gotoAndStop("E3");
  59.             _root.drag = this.pDrag;
  60.             this.origX = this._x;
  61.             this.origY = this._y;
  62.             this.diffX = _root._xmouse - this._x;
  63.             this.diffY = _root._ymouse - this._y;
  64.             this.origDepth = this.getDepth();
  65.             this.swapDepths(15050);
  66.          }
  67.       }
  68.    };
  69.    this[dragClip + "_" + gimme2digits(i)].onRelease = this[dragClip + "_" + gimme2digits(i)].onReleaseOutside = function()
  70.    {
  71.       gereCursor(3);
  72.       if(this.pDone == undefined)
  73.       {
  74.          if(_root.foundDrop == undefined)
  75.          {
  76.             joueBruitage({nomSon:"B_NO"});
  77.             this._x = this.origX;
  78.             this._y = this.origY;
  79.             this.swapDepths(this.origDepth);
  80.          }
  81.          else
  82.          {
  83.             trace("OK");
  84.             this.swapDepths(this.origDepth);
  85.             this._x = this.origX;
  86.             this._y = this.origY;
  87.             joueBruitage({nomSon:"B_01_" + gimme2digits(this.pDrag) + "_DROP"});
  88.             _root.countDone += 1;
  89.             this.pDone = 1;
  90.             this.gotoAndStop("E4");
  91.          }
  92.          _root.drag = undefined;
  93.       }
  94.    };
  95.    this[dragClip + "_" + gimme2digits(i)].onEnterFrame = function()
  96.    {
  97.       if(_root.drag == this.pDrag)
  98.       {
  99.          this._x = _root._xmouse - this.diffX;
  100.          this._y = _root._ymouse - this.diffY;
  101.          if(this._x < CONTRAINT._x + this._width / 2)
  102.          {
  103.             this._x = CONTRAINT._x + this._width / 2;
  104.          }
  105.          else if(this._x > CONTRAINT._x + CONTRAINT._width - this._width / 2)
  106.          {
  107.             this._x = CONTRAINT._x + CONTRAINT._width - this._width / 2;
  108.          }
  109.          if(this._y < CONTRAINT._y + this._height / 2)
  110.          {
  111.             this._y = CONTRAINT._y + this._height / 2;
  112.          }
  113.          else if(this._y > CONTRAINT._y + CONTRAINT._height - this._height / 2)
  114.          {
  115.             this._y = CONTRAINT._y + CONTRAINT._height - this._height / 2;
  116.          }
  117.          _root.foundDrop = undefined;
  118.          var _loc3_ = 0;
  119.          while(_loc3_ < _root.listCible.length)
  120.          {
  121.             if(_root[_root.listCible[_loc3_]].hitTest(_root._xmouse,_root._ymouse,1))
  122.             {
  123.                trace("FOUND");
  124.                switch(this.pDrag)
  125.                {
  126.                   case 1:
  127.                      if(_loc3_ == 0)
  128.                      {
  129.                         _root.foundDrop = _loc3_;
  130.                      }
  131.                      break;
  132.                   case 2:
  133.                      if(_loc3_ == 1)
  134.                      {
  135.                         _root.foundDrop = _loc3_;
  136.                      }
  137.                }
  138.             }
  139.             _loc3_ = _loc3_ + 1;
  140.          }
  141.       }
  142.    };
  143.    i++;
  144. }
  145.