home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 145 / MOBICLIC145.ISO / pc / DATA / DSS145 / DSS145_06 / DSS145_06.swf / scripts / dss145_06 / CapsuleAlgo.as < prev   
Text File  |  2012-07-18  |  23KB  |  663 lines

  1. package dss145_06
  2. {
  3.    import com.milanpresse.engine.Engine;
  4.    import com.milanpresse.engine.initmovieclip.InteractiveMovie;
  5.    import com.milanpresse.engine.managers.PauseManager;
  6.    import com.milanpresse.engine.managers.TimelineManager;
  7.    import com.milanpresse.engine.medias.MediaSwf;
  8.    import com.milanpresse.engine.timelines.Timeline;
  9.    import com.milanpresse.engine.timelines.TimelineLinear;
  10.    import com.milanpresse.engine.typeargument.CommentObject;
  11.    import com.milanpresse.engine.typeargument.NoiseObject;
  12.    import com.milanpresse.tools.GlobalesFunctions;
  13.    import flash.display.MovieClip;
  14.    import flash.geom.Point;
  15.    import flash.net.SharedObject;
  16.    
  17.    public class CapsuleAlgo
  18.    {
  19.        
  20.       
  21.       private var menu:MediaSwf;
  22.       
  23.       private var menuTimeline:MovieClip;
  24.       
  25.       private var menuTL:Timeline;
  26.       
  27.       private var mainClip:MediaSwf;
  28.       
  29.       private var mainTimeline:MovieClip;
  30.       
  31.       private var _engine:Engine;
  32.       
  33.       private var labelList:Array;
  34.       
  35.       private var _timeline_:TimelineLinear;
  36.       
  37.       private var _timelineManager:TimelineManager;
  38.       
  39.       private var _pauseManager:PauseManager;
  40.       
  41.       private var labelsCallback:Object;
  42.       
  43.       private var firstLabel:String;
  44.       
  45.       private var so:SharedObject;
  46.       
  47.       private var gListDone:Array;
  48.       
  49.       private var gListeObjet:Array;
  50.       
  51.       private var gListeCibles:Array;
  52.       
  53.       private var gListeCurrentCibles:Array;
  54.       
  55.       private var gDoneDepart:Boolean;
  56.       
  57.       private var BT_RETOUR:BtRetour;
  58.       
  59.       private var FLEUVE_01:MovieClip;
  60.       
  61.       private var FLEUVE_02:MovieClip;
  62.       
  63.       private var gListeDone:Array;
  64.       
  65.       private var gPosFleuve1:int;
  66.       
  67.       private var gPosFleuve2:int;
  68.       
  69.       private var gDrag:MovieClip = null;
  70.       
  71.       private var gObjet:MovieClip;
  72.       
  73.       private var commentEchecNum:int = 1;
  74.       
  75.       private var gOkBad:String;
  76.       
  77.       private var gNumFleuve:int;
  78.       
  79.       private var gNumObstacle:int;
  80.       
  81.       private var gListeLM:Array;
  82.       
  83.       private var gFirstTime:Boolean = true;
  84.       
  85.       public function CapsuleAlgo(engine:Engine)
  86.       {
  87.          this.labelsCallback = {"_11":"prioAnim"};
  88.          this.gListeLM = [];
  89.          super();
  90.          this._engine = engine;
  91.          this._engine.playMusic({"code":"MU"});
  92.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  93.          this._engine.setFrameRate(12);
  94.          this.mainClip = this._engine.showSwf({
  95.             "code":"A_" + this._engine.config.moduleName,
  96.             "parent":this._engine.config.layers["content"]
  97.          });
  98.          this.mainTimeline = this.mainClip.swfContent;
  99.          this._timelineManager = new TimelineManager();
  100.          this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  101.          this._engine.levelCZ = this._engine.config.layers["content"];
  102.          this.firstLabel = this.mainTimeline.currentLabels[0].name;
  103.          this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
  104.          this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
  105.          this.gListDone = this.so.data.listDone;
  106.          this.gDoneDepart = this.gListDone[this._engine.config.moduleNum - 1] == 1;
  107.          this.BT_RETOUR = new BtRetour(this._engine,this._timelineManager,this.so);
  108.       }
  109.       
  110.       public function labelATTENTE_JEU() : void
  111.       {
  112.          var i:int = 0;
  113.          var j:int = 0;
  114.          var myMc:InteractiveMovie = null;
  115.          if(this.gFirstTime == true)
  116.          {
  117.             this.gFirstTime = false;
  118.             this._engine.hideLM({"into":this.mainTimeline.LM_DEPOT_01_01});
  119.             this._engine.hideLM({"into":this.mainTimeline.LM_DEPOT_01_02});
  120.             this._engine.hideLM({"into":this.mainTimeline.LM_DEPOT_01_03});
  121.             this._engine.hideLM({"into":this.mainTimeline.LM_DEPOT_02_01});
  122.             this._engine.hideLM({"into":this.mainTimeline.LM_DEPOT_02_02});
  123.             this._engine.hideLM({"into":this.mainTimeline.LM_DEPOT_02_03});
  124.          }
  125.          else
  126.          {
  127.             for(i = 1; i <= 2; i++)
  128.             {
  129.                for(j = 1; j <= 3; j++)
  130.                {
  131.                   if(this.gListeLM.indexOf("LM_DEPOT_0" + i + "_0" + j) !== -1)
  132.                   {
  133.                      this._engine.hideLM({"into":this.mainTimeline["LM_DEPOT_0" + i + "_0" + j]});
  134.                      this.gListeLM.splice(this.gListeLM.indexOf("LM_DEPOT_0" + i + "_0" + j),1);
  135.                   }
  136.                }
  137.             }
  138.          }
  139.          trace("labelATTENTE_JEU");
  140.          this.gListeDone = [[0,0,0],[0,0,0]];
  141.          this.gListeObjet = [[1,2,3],[4,5,6]];
  142.          this.gListeCibles = [[[],[],[]],[[],[],[]]];
  143.          this.gPosFleuve1 = 0;
  144.          this.gPosFleuve2 = 0;
  145.          this.FLEUVE_01 = new InteractiveMovie(this.mainTimeline["FLEUVE_01"],this._timelineManager);
  146.          this.FLEUVE_01.gotoAndStop("E" + this.gPosFleuve1);
  147.          this.FLEUVE_02 = new InteractiveMovie(this.mainTimeline["FLEUVE_02"],this._timelineManager);
  148.          this.FLEUVE_02.gotoAndStop("E" + this.gPosFleuve2);
  149.          for(i = 1; i <= 8; i++)
  150.          {
  151.             myMc = new InteractiveMovie(this.mainTimeline["OBJ_" + this.G2D(i)],this._timelineManager);
  152.             myMc.mc.pNum = i;
  153.             myMc.mc.pNoiseRoll = "B_" + this.G2D(i);
  154.             myMc.mc.pNoiseClic = "B_CLIC";
  155.             myMc.gotoAndStop("E1");
  156.             this.initMc(myMc);
  157.          }
  158.          for(i = 1; i <= 2; i++)
  159.          {
  160.             for(j = 1; j <= 3; j++)
  161.             {
  162.                myMc = new InteractiveMovie(this.mainTimeline["OK_" + this.G2D(i) + "_" + this.G2D(j)],this._timelineManager);
  163.                myMc.mc.pNumFleuve = i;
  164.                myMc.mc.pNum = j;
  165.                myMc.gotoAndStop("E0");
  166.                this.gListeCibles[i - 1][j - 1].push(myMc);
  167.                myMc = new InteractiveMovie(this.mainTimeline["BAD_" + this.G2D(i) + "_" + this.G2D(j)],this._timelineManager);
  168.                myMc.mc.pNumFleuve = i;
  169.                myMc.mc.pNum = j;
  170.                myMc.gotoAndStop("E0");
  171.                this.gListeCibles[i - 1][j - 1].push(myMc);
  172.             }
  173.          }
  174.          this.initCurrentCibles();
  175.          myMc = new InteractiveMovie(this.mainTimeline["BT_REJOUER"],this._timelineManager);
  176.          myMc.gotoAndStop("E1");
  177.       }
  178.       
  179.       public function initCurrentCibles() : void
  180.       {
  181.          var pListe:Array = null;
  182.          var i:int = 0;
  183.          this.gListeCurrentCibles = [];
  184.          if(this.gPosFleuve1 < 3)
  185.          {
  186.             pListe = this.gListeCibles[0][this.gPosFleuve1];
  187.             for(i = 0; i <= 1; i++)
  188.             {
  189.                trace("pListe[i].mc",pListe[i].mc.name);
  190.                pListe[i].gotoAndStop("E1");
  191.                this.gListeCurrentCibles.push(pListe[i]);
  192.             }
  193.          }
  194.          if(this.gPosFleuve2 < 3)
  195.          {
  196.             pListe = this.gListeCibles[1][this.gPosFleuve2];
  197.             for(i = 0; i <= 1; i++)
  198.             {
  199.                trace("___ pListe[i].mc",pListe[i].mc.name);
  200.                pListe[i].gotoAndStop("E1");
  201.                this.gListeCurrentCibles.push(pListe[i]);
  202.             }
  203.          }
  204.          this._engine.playNoise(new NoiseObject({"code":"B_ZONE"}));
  205.          this.testShowLM();
  206.       }
  207.       
  208.       public function initMc(myMc:MovieClip) : void
  209.       {
  210.          trace("myMc.mc",myMc.mc.name);
  211.          myMc.mc.onRollOver = function(p:Object):void
  212.          {
  213.             if(gDrag == null)
  214.             {
  215.                _engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
  216.             }
  217.          };
  218.          myMc.mc.onRollOut = function(p:Object):void
  219.          {
  220.             if(gDrag == null)
  221.             {
  222.                _engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
  223.             }
  224.          };
  225.          myMc.mc.onMouseDown = function(p:Object):void
  226.          {
  227.             trace("DOWN",myMc.mc.name);
  228.             if(gDrag == null)
  229.             {
  230.                gDrag = this;
  231.                disableAll();
  232.                this.pCible = undefined;
  233.                _engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
  234.                _engine.playNoise(new NoiseObject({"code":this.pNoiseClic}));
  235.                this.alpha = 0.5;
  236.             }
  237.          };
  238.          myMc.mc.onMouseUp = function(p:Object):void
  239.          {
  240.             if(gDrag == this)
  241.             {
  242.                trace("UP",myMc.mc.name);
  243.                this.alpha = 1;
  244.                trace("this.name",this.name);
  245.                trace("this.pCible",this.pCible);
  246.                _engine.playNoise(new NoiseObject({"code":"B_DEPOT"}));
  247.                if(this.pCible == undefined)
  248.                {
  249.                   this.returnOrigPoint();
  250.                   this.timeline.GotoAndStop("E1");
  251.                }
  252.                else
  253.                {
  254.                   gOkBad = this.pCible.mc.name.split("_")[0];
  255.                   gNumFleuve = Number(this.pCible.mc.name.split("_")[1]);
  256.                   gNumObstacle = Number(this.pCible.mc.name.split("_")[2]);
  257.                   trace("testCasParticulier(this.pNum)",testCasParticulier(this.pNum));
  258.                   trace("testCasParticulierInverse(this.pNum)",testCasParticulierInverse(this.pNum));
  259.                   if(this.pNum == gListeObjet[gNumFleuve - 1][gNumObstacle - 1] && testCasParticulier(this.pNum) == false || testCasParticulierInverse(this.pNum) == true)
  260.                   {
  261.                      testHideLM();
  262.                      gObjet = this;
  263.                      this.timeline.GotoAndPlayUntilTheEnd("E3",finE3);
  264.                      if(this.pNum == 6 || this.pNum == 8)
  265.                      {
  266.                         _engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
  267.                      }
  268.                      desinitZones();
  269.                      trace("bon objet",this.pNum + " " + gListeObjet[gNumFleuve - 1][gNumObstacle - 1]);
  270.                   }
  271.                   else
  272.                   {
  273.                      this.returnOrigPoint();
  274.                      if(testCasParticulier(this.pNum))
  275.                      {
  276.                         _engine.playNoise(new NoiseObject({"code":"B_ERREUR"}));
  277.                      }
  278.                      else
  279.                      {
  280.                         trace("mauvais objet",this.pNum + " " + gListeObjet[gNumFleuve - 1][gNumObstacle - 1]);
  281.                         _engine.playComment(new CommentObject({"code":"E" + G2D(gListeObjet[gNumFleuve - 1][gNumObstacle - 1])}));
  282.                      }
  283.                      this.pCible.gotoAndStop("E1");
  284.                      this.timeline.GotoAndStop("E1");
  285.                   }
  286.                }
  287.             }
  288.             ableAll();
  289.             gDrag = null;
  290.          };
  291.          myMc.mc.onEnterFrame = function(p:Object):void
  292.          {
  293.             var tpoint:Point = new Point(this.stage.mouseX,this.stage.mouseY);
  294.             var pLength:int = gListeCurrentCibles.length;
  295.             var lCibleFound:Boolean = false;
  296.             for(var i:int = 0; i < pLength; i++)
  297.             {
  298.                if(gListeCurrentCibles[i].mc.hitTestPoint(tpoint.x,tpoint.y,true))
  299.                {
  300.                   lCibleFound = true;
  301.                   if(this.pCible !== undefined)
  302.                   {
  303.                      trace("touche",gListeCurrentCibles[i].mc.name);
  304.                      gListeCurrentCibles[i].gotoAndStop("E2");
  305.                      if(this.pCible !== undefined)
  306.                      {
  307.                         this.pCible.gotoAndStop("E1");
  308.                      }
  309.                      _engine.playNoise(new NoiseObject({"code":"B_SURVOL"}));
  310.                      this.pCible = gListeCurrentCibles[i];
  311.                      break;
  312.                   }
  313.                }
  314.             }
  315.             if(lCibleFound == false && this.pCible !== undefined)
  316.             {
  317.                _engine.stopNoise(new NoiseObject({"code":"B_SURVOL"}));
  318.                this.pCible.gotoAndStop("E1");
  319.                this.pCible = undefined;
  320.             }
  321.          };
  322.          myMc.activeDragAndDropMC();
  323.       }
  324.       
  325.       public function ableAll() : void
  326.       {
  327.          var myMc:InteractiveMovie = null;
  328.          for(var i:int = 1; i <= 8; i++)
  329.          {
  330.             myMc = new InteractiveMovie(this.mainTimeline["OBJ_" + this.G2D(i)],this._timelineManager);
  331.             if(myMc.mc !== this.gDrag)
  332.             {
  333.                myMc.mc.active();
  334.             }
  335.          }
  336.       }
  337.       
  338.       public function disableAll() : void
  339.       {
  340.          var myMc:InteractiveMovie = null;
  341.          for(var i:int = 1; i <= 8; i++)
  342.          {
  343.             myMc = new InteractiveMovie(this.mainTimeline["OBJ_" + this.G2D(i)],this._timelineManager);
  344.             if(myMc.mc !== this.gDrag)
  345.             {
  346.                myMc.mc.desactive();
  347.             }
  348.          }
  349.       }
  350.       
  351.       public function testShowLM() : void
  352.       {
  353.          var pFleuveEtat:int = 0;
  354.          var pCodeLM:String = null;
  355.          trace("testShowLM()");
  356.          for(var i:int = 1; i <= 2; i++)
  357.          {
  358.             pFleuveEtat = this["gPosFleuve" + i] + 1;
  359.             if(pFleuveEtat <= 3)
  360.             {
  361.                pCodeLM = "LM_DEPOT_0" + i + "_0" + pFleuveEtat;
  362.                if(this.gListeLM.indexOf(pCodeLM) == -1)
  363.                {
  364.                   this._engine.showLM({
  365.                      "id":pCodeLM,
  366.                      "findModelIn":this.mainTimeline
  367.                   });
  368.                   this.gListeLM.push(pCodeLM);
  369.                }
  370.             }
  371.          }
  372.       }
  373.       
  374.       public function testHideLM() : void
  375.       {
  376.          if(this.gListeLM.indexOf("LM_DEPOT_0" + this.gNumFleuve + "_0" + this.gNumObstacle) !== -1)
  377.          {
  378.             this._engine.hideLM({"into":this.mainTimeline["LM_DEPOT_0" + this.gNumFleuve + "_0" + this.gNumObstacle]});
  379.             this.gListeLM.splice(this.gListeLM.indexOf("LM_DEPOT_0" + this.gNumFleuve + "_0" + this.gNumObstacle),1);
  380.          }
  381.       }
  382.       
  383.       public function testCasParticulier(pNum:int) : Boolean
  384.       {
  385.          var pCasPartFound:Boolean = false;
  386.          if(this.gNumFleuve == 2 && this.gNumObstacle == 1 && this.gOkBad == "OK" && pNum == 7)
  387.          {
  388.             trace("cas 1");
  389.             pCasPartFound = true;
  390.          }
  391.          if(this.gNumFleuve == 2 && this.gNumObstacle == 1 && this.gOkBad == "BAD" && pNum == 4)
  392.          {
  393.             trace("cas 2");
  394.             pCasPartFound = true;
  395.          }
  396.          if(this.gNumFleuve == 2 && this.gNumObstacle == 3 && this.gOkBad == "OK" && pNum == 8)
  397.          {
  398.             trace("cas 3");
  399.             pCasPartFound = true;
  400.          }
  401.          if(this.gNumFleuve == 2 && this.gNumObstacle == 3 && this.gOkBad == "BAD" && pNum == 6)
  402.          {
  403.             trace("cas 4");
  404.             pCasPartFound = true;
  405.          }
  406.          return pCasPartFound;
  407.       }
  408.       
  409.       public function testCasParticulierInverse(pNum:int) : Boolean
  410.       {
  411.          var pCasPartFound:Boolean = false;
  412.          if(this.gNumFleuve == 2 && this.gNumObstacle == 1 && this.gOkBad == "BAD" && pNum == 7)
  413.          {
  414.             trace("cas inverse 2");
  415.             pCasPartFound = true;
  416.          }
  417.          if(this.gNumFleuve == 2 && this.gNumObstacle == 3 && this.gOkBad == "BAD" && pNum == 8)
  418.          {
  419.             trace("cas inverse 4");
  420.             pCasPartFound = true;
  421.          }
  422.          return pCasPartFound;
  423.       }
  424.       
  425.       public function finE3() : void
  426.       {
  427.          var mc:MovieClip = null;
  428.          var tl:Timeline = null;
  429.          var pLabelNum:int = 0;
  430.          var otherCible:MovieClip = null;
  431.          trace("finE3");
  432.          if(this.gObjet.pCible.hasLabel("E3"))
  433.          {
  434.             this.gObjet.pCible.gotoAndPlayUntilTheEnd("E3");
  435.          }
  436.          else
  437.          {
  438.             this.gObjet.pCible.gotoAndStop("E0");
  439.          }
  440.          this.gObjet.returnOrigPoint();
  441.          this.gObjet.timeline.GotoAndStop("E1");
  442.          if(this.gObjet.pNum == 6 || this.gObjet.pNum == 8)
  443.          {
  444.             this._engine.stopNoise(new NoiseObject({"code":this.gObjet.pNoiseRoll}));
  445.          }
  446.          if(this.gNumFleuve == 1)
  447.          {
  448.             if(this.gOkBad == "OK")
  449.             {
  450.                this.gPosFleuve1 += 1;
  451.                if(this.gNumObstacle < 3)
  452.                {
  453.                   this._engine.playNoise(new NoiseObject({"code":"B_OK"}));
  454.                }
  455.                else
  456.                {
  457.                   this._engine.playNoise(new NoiseObject({"code":"B_SUCCES"}));
  458.                }
  459.                otherCible = this.mainTimeline["BAD_" + this.G2D(this.gNumFleuve) + "_" + this.G2D(this.gNumObstacle)];
  460.             }
  461.             else
  462.             {
  463.                this.gPosFleuve1 += 4;
  464.                this._engine.playNoise(new NoiseObject({"code":"B_BAD"}));
  465.                otherCible = this.mainTimeline["OK_" + this.G2D(this.gNumFleuve) + "_" + this.G2D(this.gNumObstacle)];
  466.             }
  467.             otherCible.timeline.GotoAndStop("E0");
  468.             this.FLEUVE_01.gotoAndStop("E" + this.gPosFleuve1);
  469.             pLabelNum = Number(this.FLEUVE_01.mc.currentLabel.substr(1,1));
  470.             mc = this.FLEUVE_01.mc.anim;
  471.             tl = new Timeline(mc,this._timelineManager);
  472.             if(pLabelNum < 4)
  473.             {
  474.                tl.GotoAndPlayUntilTheEnd(1,this.nextEtapeF1);
  475.             }
  476.             else
  477.             {
  478.                tl.GotoAndPlayUntilTheEnd(1,this.perdu);
  479.             }
  480.          }
  481.          else
  482.          {
  483.             if(this.gOkBad == "OK")
  484.             {
  485.                this.gPosFleuve2 += 1;
  486.                if(this.gNumObstacle < 3)
  487.                {
  488.                   this._engine.playNoise(new NoiseObject({"code":"B_OK"}));
  489.                }
  490.                else
  491.                {
  492.                   this._engine.playNoise(new NoiseObject({"code":"B_SUCCES"}));
  493.                }
  494.                otherCible = this.mainTimeline["BAD_" + this.G2D(this.gNumFleuve) + "_" + this.G2D(this.gNumObstacle)];
  495.             }
  496.             else
  497.             {
  498.                this.gPosFleuve2 += 4;
  499.                this._engine.playNoise(new NoiseObject({"code":"B_BAD"}));
  500.                otherCible = this.mainTimeline["OK_" + this.G2D(this.gNumFleuve) + "_" + this.G2D(this.gNumObstacle)];
  501.             }
  502.             otherCible.timeline.GotoAndStop("E0");
  503.             this.FLEUVE_02.gotoAndStop("E" + this.gPosFleuve2);
  504.             pLabelNum = Number(this.FLEUVE_02.mc.currentLabel.substr(1,1));
  505.             mc = this.FLEUVE_02.mc.anim;
  506.             tl = new Timeline(mc,this._timelineManager);
  507.             if(pLabelNum < 4)
  508.             {
  509.                tl.GotoAndPlayUntilTheEnd(1,this.nextEtapeF2);
  510.             }
  511.             else
  512.             {
  513.                tl.GotoAndPlayUntilTheEnd(1,this.perdu);
  514.             }
  515.          }
  516.       }
  517.       
  518.       public function desinitZones() : void
  519.       {
  520.          var myMc:InteractiveMovie = null;
  521.          for(var i:int = 1; i <= 8; i++)
  522.          {
  523.             myMc = new InteractiveMovie(this.mainTimeline["OBJ_" + this.G2D(i)],this._timelineManager);
  524.             myMc.desactive();
  525.             myMc.mc.mouseEnabled = false;
  526.             myMc.mc.mouseChildren = false;
  527.          }
  528.       }
  529.       
  530.       public function initZones() : void
  531.       {
  532.          var myMc:InteractiveMovie = null;
  533.          for(var i:int = 1; i <= 8; i++)
  534.          {
  535.             myMc = new InteractiveMovie(this.mainTimeline["OBJ_" + this.G2D(i)],this._timelineManager);
  536.             myMc.active();
  537.             myMc.mc.mouseEnabled = true;
  538.             myMc.mc.mouseChildren = true;
  539.          }
  540.       }
  541.       
  542.       public function nextEtapeF1() : void
  543.       {
  544.          trace("nextEtapeF1");
  545.          if(this.gPosFleuve1 < 3)
  546.          {
  547.             this.initCurrentCibles();
  548.             this.initZones();
  549.          }
  550.          else
  551.          {
  552.             trace("fleuve1 fini");
  553.             if(this.gPosFleuve2 == 3)
  554.             {
  555.                trace("tout fini");
  556.                this.save();
  557.                this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_GAGNE"});
  558.             }
  559.             else
  560.             {
  561.                this.initCurrentCibles();
  562.                this.initZones();
  563.             }
  564.          }
  565.       }
  566.       
  567.       public function labelWAIT_GAGNE() : void
  568.       {
  569.          this.mainTimeline.LM_DEPOT_01_01.visible = false;
  570.       }
  571.       
  572.       public function nextEtapeF2() : void
  573.       {
  574.          trace("nextEtapeF2");
  575.          if(this.gPosFleuve2 < 3)
  576.          {
  577.             this.initCurrentCibles();
  578.             this.initZones();
  579.          }
  580.          else
  581.          {
  582.             trace("fleuve2 fini");
  583.             if(this.gPosFleuve1 == 3)
  584.             {
  585.                trace("tout fini");
  586.                this.save();
  587.                this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_GAGNE"});
  588.             }
  589.             else
  590.             {
  591.                this.initCurrentCibles();
  592.                this.initZones();
  593.             }
  594.          }
  595.       }
  596.       
  597.       public function perdu() : void
  598.       {
  599.          trace("perdu");
  600.          this._engine.playComment(new CommentObject({
  601.             "code":"B" + this.G2D(this.commentEchecNum),
  602.             "callback":this.labelATTENTE_JEU
  603.          }));
  604.          if(this.commentEchecNum == 3)
  605.          {
  606.             this.commentEchecNum = 1;
  607.          }
  608.          else
  609.          {
  610.             this.commentEchecNum += 1;
  611.          }
  612.          this.initZones();
  613.       }
  614.       
  615.       public function G2D(value:int) : String
  616.       {
  617.          return GlobalesFunctions.gimme2digits(value);
  618.       }
  619.       
  620.       public function save() : void
  621.       {
  622.          this.BT_RETOUR._gameWon = true;
  623.          this.gListDone[this._engine.config.moduleNum - 1] = 1;
  624.          if(this.gDoneDepart)
  625.          {
  626.             this.so.data.lastDone = 2;
  627.          }
  628.          else
  629.          {
  630.             this.so.data.lastDone = 1;
  631.          }
  632.          this.so.data.listDone = this.gListDone;
  633.          this.so.flush();
  634.       }
  635.       
  636.       public function endMODULE() : void
  637.       {
  638.          trace("fin du module");
  639.          this._engine.host.changeModule({"numMod":0});
  640.       }
  641.       
  642.       public function sleep() : void
  643.       {
  644.          this._pauseManager = new PauseManager(this._engine,this._timelineManager);
  645.          this._pauseManager.sleepMovie(this.mainTimeline);
  646.       }
  647.       
  648.       public function wake() : void
  649.       {
  650.          if(this._pauseManager != null)
  651.          {
  652.             this._pauseManager.wakeMovie(this.mainTimeline);
  653.          }
  654.       }
  655.       
  656.       public function destroy() : void
  657.       {
  658.          this._engine.stopAllSounds();
  659.          this._timeline_.kilListeners();
  660.       }
  661.    }
  662. }
  663.