home *** CD-ROM | disk | FTP | other *** search
/ The Great Adventure of Natural Gas / start / start.swf / scripts / DefineSprite_288 / frame_1 / DoAction.as
Encoding:
Text File  |  2007-01-01  |  3.5 KB  |  125 lines

  1. function efface()
  2. {
  3.    var i = 0;
  4.    while(i < tabObjs.length)
  5.    {
  6.       eval(tabObjs[i])._visible = false;
  7.       i++;
  8.    }
  9.    var i = 1;
  10.    while(i < 8)
  11.    {
  12.       this["d" + i].num = i;
  13.       this["d" + i]._visible = false;
  14.       i++;
  15.    }
  16. }
  17. function resetObjs()
  18. {
  19.    var _loc3_ = _parent;
  20.    var _loc2_ = 0;
  21.    while(_loc2_ < objZones.length)
  22.    {
  23.       var _loc1_ = _loc3_.menuDD[objZones[_loc2_]];
  24.       _loc3_.menuDD.croixrouge._visible = false;
  25.       _loc1_.softGoTo(_loc1_.startx,_loc1_.starty,0.5);
  26.       _loc2_ = _loc2_ + 1;
  27.    }
  28. }
  29. function flashNext()
  30. {
  31.    var _loc1_ = _parent;
  32.    var _loc2_ = this;
  33.    if(_loc2_._parent["d" + numflash] != null)
  34.    {
  35.       trace("flash");
  36.       _loc2_._parent["d" + numflash]._visible = true;
  37.       _loc2_._parent["d" + numflash].flashSoluce(flashNext);
  38.       numflash++;
  39.    }
  40.    else
  41.    {
  42.       _loc1_.expliDD._visible = true;
  43.       _loc1_.expliDD._xscale = 1;
  44.       _loc1_.expliDD._yscale = _loc1_.expliDD._xscale;
  45.       _loc1_.expliDD.bounceScale(100,100,0.2,0.8);
  46.    }
  47. }
  48. function initDD()
  49. {
  50.    decors.bateau.gotoAndStop(136);
  51.    var i = 1;
  52.    while(i < 8)
  53.    {
  54.       dzone = this["d" + i];
  55.       dzone.obj = objZones[i - 1];
  56.       dzone.num = i;
  57.       dzone.fond._name = objZones[i];
  58.       dzone.gotoAndStop(2);
  59.       i++;
  60.    }
  61.    numflash = 1;
  62.    d1.flashNext = flashNext;
  63.    d1.flashNext();
  64.    var i = 0;
  65.    while(i < objZones.length)
  66.    {
  67.       var obj = _parent.menuDD[objZones[i]];
  68.       obj.startx = obj._x;
  69.       obj.starty = obj._y;
  70.       obj.onPress = function()
  71.       {
  72.          this.startDrag();
  73.       };
  74.       obj.onRelease = obj.onReleaseOutside = function()
  75.       {
  76.          var zone = eval(this._droptarget)._parent;
  77.          if(zone.num == _root.activeNum)
  78.          {
  79.             this.stopDrag();
  80.             if(zone.obj == this._name)
  81.             {
  82.                trace("gagn├⌐");
  83.                _root.mcgagne._visible = true;
  84.                _root.mcgagne._xscale = 5;
  85.                _root.mcgagne._yscale = 5;
  86.                _root.mcgagne.bounceScale(100,100,0.2,0.8);
  87.                _root.btnmask._visible = true;
  88.                _root.btnsuite._visible = true;
  89.                this._visible = false;
  90.                zone._visible = false;
  91.                _root.mcscene[this._name]._visible = true;
  92.                _root.mcscene[this._name].flashSoluce();
  93.                _root.mcscene.decors[this._name]._visible = true;
  94.                _root.mcscene.decors[this._name].flashSoluce();
  95.                _root.mcscene.decors[this._name].play();
  96.                zone.gotoAndStop(3);
  97.             }
  98.             else
  99.             {
  100.                trace("perdu");
  101.                _root.playSound("sonerreur",60);
  102.                this._parent.croixrouge._visible = true;
  103.                this._parent.croixrouge._x = this._x;
  104.                this._parent.croixrouge._y = this._y;
  105.                _root.mcperdu._visible = true;
  106.                _root.mcperdu._xscale = 5;
  107.                _root.mcperdu._yscale = 5;
  108.                _root.mcperdu.bounceScale(100,100,0.2,0.8);
  109.                _root.btnmask._visible = true;
  110.                _parent.nbfaux = _parent.nbfaux + 1;
  111.             }
  112.          }
  113.          else
  114.          {
  115.             this.softGoTo(this.startx,this.starty,0.5);
  116.             this.stopDrag();
  117.          }
  118.       };
  119.       i++;
  120.    }
  121. }
  122. tabObjs = ["camion","gisement","derrick","decors.bateau","tuyau","station","reservoir","chauffeau"];
  123. objZones = ["camion","gisement","derrick","bateau","reservoir","station","chauffeau"];
  124. efface();
  125.