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

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