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

  1. package dss145_02
  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.timers.ExtendedTimer;
  11.    import com.milanpresse.engine.typeargument.CommentObject;
  12.    import com.milanpresse.engine.typeargument.NoiseObject;
  13.    import com.milanpresse.tools.GlobalesFunctions;
  14.    import flash.display.MovieClip;
  15.    import flash.display.Sprite;
  16.    import flash.events.Event;
  17.    import flash.events.MouseEvent;
  18.    import flash.events.TimerEvent;
  19.    import flash.geom.Point;
  20.    import flash.net.SharedObject;
  21.    import flash.ui.Mouse;
  22.    
  23.    public class CapsuleAlgo
  24.    {
  25.        
  26.       
  27.       private var menu:MediaSwf;
  28.       
  29.       private var menuTimeline:MovieClip;
  30.       
  31.       private var menuTL:Timeline;
  32.       
  33.       private var mainClip:MediaSwf;
  34.       
  35.       private var mainTimeline:MovieClip;
  36.       
  37.       private var _engine:Engine;
  38.       
  39.       private var labelList:Array;
  40.       
  41.       private var _timeline_:TimelineLinear;
  42.       
  43.       private var _timelineManager:TimelineManager;
  44.       
  45.       private var _pauseManager:PauseManager;
  46.       
  47.       private var _pauseManager_:PauseManager;
  48.       
  49.       private var _pausedAIDE:Boolean = false;
  50.       
  51.       private var labelsCallback:Object;
  52.       
  53.       private var firstLabel:String;
  54.       
  55.       private var so:SharedObject;
  56.       
  57.       private var gListDone:Array;
  58.       
  59.       private var gListeObjet:Array;
  60.       
  61.       private var gListeCibles:Array;
  62.       
  63.       private var gListeCurrentCibles:Array;
  64.       
  65.       private var gDoneDepart:Boolean;
  66.       
  67.       private var BT_RETOUR:BtRetour;
  68.       
  69.       private var CURSEUR_TORCHE:MovieClip;
  70.       
  71.       private var PANO_AIDE:MovieClip;
  72.       
  73.       private var BT_AIDE:InteractiveMovie;
  74.       
  75.       private var BT_REJOUER:InteractiveMovie;
  76.       
  77.       private var HERAKLES:InteractiveMovie;
  78.       
  79.       private var gListeDone:Array;
  80.       
  81.       private var gListeTete:Array;
  82.       
  83.       private var timeGame:Number;
  84.       
  85.       private var timeTotal:Number;
  86.       
  87.       private var timeAttaque:int;
  88.       
  89.       private var timer_JEU:ExtendedTimer;
  90.       
  91.       private var timer_TOTAL:ExtendedTimer;
  92.       
  93.       private var timer_HERAKLES:ExtendedTimer;
  94.       
  95.       private var TIMER:InteractiveMovie;
  96.       
  97.       private var gCountTete:int;
  98.       
  99.       private var gCountSec:int;
  100.       
  101.       private var gCountSecCouTete:int;
  102.       
  103.       private var HYDREteteActive:InteractiveMovie;
  104.       
  105.       private var HYDREdemo:InteractiveMovie;
  106.       
  107.       private var jeuPerdu:Boolean = false;
  108.       
  109.       private var _startTime:Number;
  110.       
  111.       private var _startTimeJEU:Number;
  112.       
  113.       public function CapsuleAlgo(engine:Engine)
  114.       {
  115.          this.labelsCallback = {
  116.             "_07":this.label_07,
  117.             "_08":"prioAnim",
  118.             "PERDU":this.labelPERDU
  119.          };
  120.          super();
  121.          this._engine = engine;
  122.          this._engine.playMusic({"code":"MU"});
  123.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  124.          this._engine.setFrameRate(12);
  125.          this.mainClip = this._engine.showSwf({
  126.             "code":"A_" + this._engine.config.moduleName,
  127.             "parent":this._engine.config.layers["content"]
  128.          });
  129.          this.mainTimeline = this.mainClip.swfContent;
  130.          this._timelineManager = new TimelineManager();
  131.          this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  132.          this._engine.levelCZ = this._engine.config.layers["content"];
  133.          this.firstLabel = this.mainTimeline.currentLabels[0].name;
  134.          this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
  135.          this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
  136.          this.gListDone = this.so.data.listDone;
  137.          this.gDoneDepart = this.gListDone[this._engine.config.moduleNum - 1] == 1;
  138.          this.BT_RETOUR = new BtRetour(this._engine,this._timelineManager,this.so);
  139.          this.BT_RETOUR.setFunctionHideCursorSpecial(this.hideCursorSpecial);
  140.          this.BT_RETOUR.setFunctionShowCursorSpecial(this.showCursorSpecial);
  141.          this.BT_RETOUR.setFunctionFin(this.endMODULE);
  142.          this.timeTotal = Number(this._engine.config.XmlConfig.Module.Config.timeTotal.toString());
  143.          this.timeAttaque = Number(this._engine.config.XmlConfig.Module.Config.frequenceAttaque.toString());
  144.          this.timeGame = Number(this._engine.config.XmlConfig.Module.Config.dureeCou.toString());
  145.          this.timer_TOTAL = new ExtendedTimer(1000,this.timeTotal);
  146.          this.timer_TOTAL.addEventListener(TimerEvent.TIMER,this.refreshTimer);
  147.          this.timer_TOTAL.addEventListener(TimerEvent.TIMER_COMPLETE,this.finTimerJeu);
  148.          this.timer_HERAKLES = new ExtendedTimer(this.timeAttaque * 1000);
  149.          this.timer_HERAKLES.addEventListener(TimerEvent.TIMER,this.heraklesAction);
  150.          this.timer_JEU = new ExtendedTimer(1000,this.timeGame);
  151.          this.timer_JEU.addEventListener(TimerEvent.TIMER,this.refreshCouTete);
  152.          this.timer_JEU.addEventListener(TimerEvent.TIMER_COMPLETE,this.finSequenceJeu);
  153.       }
  154.       
  155.       private function enterFrame(evt:Event) : void
  156.       {
  157.          var tpoint:Point = new Point(this.CURSEUR_TORCHE.parent.mouseX,this.CURSEUR_TORCHE.parent.mouseY);
  158.          this.CURSEUR_TORCHE.x = tpoint.x;
  159.          this.CURSEUR_TORCHE.y = tpoint.y;
  160.       }
  161.       
  162.       public function label_01() : void
  163.       {
  164.          var myMc:InteractiveMovie = null;
  165.          for(var i:int = 1; i <= 8; i++)
  166.          {
  167.             myMc = new InteractiveMovie(this.mainTimeline["HYDRE_" + this.G2D(i)],this._timelineManager);
  168.             myMc.gotoAndStop("E1");
  169.          }
  170.       }
  171.       
  172.       public function label_06() : void
  173.       {
  174.          if(this.HYDREdemo !== null)
  175.          {
  176.             this.HYDREdemo.gotoAndStop("E3");
  177.          }
  178.       }
  179.       
  180.       public function label_07() : void
  181.       {
  182.          var tl:Timeline = null;
  183.          var mc:MovieClip = this.mainTimeline["anim"];
  184.          this._engine.playComment(new CommentObject({
  185.             "code":"07",
  186.             "zapBlock":"NOZAP_NOBLOCK",
  187.             "callback":this._timeline_.nextLabel
  188.          }));
  189.          if(mc !== null)
  190.          {
  191.             tl = new Timeline(mc,this._timelineManager);
  192.             tl.GotoAndPlayUntil({
  193.                "labelPlay":1,
  194.                "labelStop":mc.totalFrames
  195.             });
  196.          }
  197.       }
  198.       
  199.       public function coupeTete() : void
  200.       {
  201.          this.HERAKLES.gotoAndStop("E1");
  202.          this.HYDREdemo = new InteractiveMovie(this.mainTimeline["HYDRE_03"],this._timelineManager);
  203.          this.HYDREdemo.gotoAndStop("E2");
  204.       }
  205.       
  206.       public function stopAutresTetes() : void
  207.       {
  208.          var myMc:MovieClip = this.mainTimeline["HYDRE"];
  209.          myMc.mouseEnabled = false;
  210.          var pLength:int = this.gListeTete.length;
  211.          for(var i:int = 1; i < pLength; i++)
  212.          {
  213.             myMc = this.mainTimeline["HYDRE_0" + this.gListeTete[i]];
  214.             myMc.mouseEnabled = false;
  215.             myMc.mouseChildren = false;
  216.             if(myMc.kill is Function)
  217.             {
  218.                myMc.kill();
  219.             }
  220.          }
  221.       }
  222.       
  223.       public function coupeTeteAleatoire() : void
  224.       {
  225.          trace("coupeTeteAleatoire","HYDRE_0" + this.gListeTete[0]);
  226.          this.HERAKLES.gotoAndStop("E1");
  227.          this.HYDREteteActive = new InteractiveMovie(this.mainTimeline["HYDRE_0" + this.gListeTete[0]],this._timelineManager);
  228.          this.HYDREteteActive.mc.mouseEnabled = true;
  229.          this.HYDREteteActive.mc.mouseChildren = true;
  230.          this.HYDREteteActive.gotoAndStop("E2");
  231.          this.stopAutresTetes();
  232.          this._engine.playNoise(new NoiseObject({"code":"B_COU_COUIC"}));
  233.          this.gCountSecCouTete = 0;
  234.          this.timer_JEU.reset();
  235.          this.timer_JEU.start();
  236.          this._startTime = new Date().time;
  237.          this.initJEU();
  238.       }
  239.       
  240.       public function showCursorSpecial(lFirst:int = 0) : void
  241.       {
  242.          if(lFirst == 1)
  243.          {
  244.             this.CURSEUR_TORCHE = this.mainTimeline.CURSEUR_TORCHE;
  245.          }
  246.          trace("SHOW CURSEUR_TORCHE",this.CURSEUR_TORCHE);
  247.          if(this.CURSEUR_TORCHE !== null)
  248.          {
  249.             if(this.BT_RETOUR._gameOn == true || lFirst == 1)
  250.             {
  251.                Mouse.hide();
  252.                this.CURSEUR_TORCHE.visible = true;
  253.                if(this.mainTimeline.hasEventListener(Event.ENTER_FRAME) == false)
  254.                {
  255.                   this.CURSEUR_TORCHE.mouseEnabled = false;
  256.                   this.CURSEUR_TORCHE.mouseChildren = false;
  257.                   this.enterFrame(new Event(""));
  258.                   this.mainTimeline.addEventListener(Event.ENTER_FRAME,this.enterFrame);
  259.                }
  260.             }
  261.          }
  262.       }
  263.       
  264.       public function leaveStage(evt:Event) : void
  265.       {
  266.          trace("leaveStage");
  267.          this.hideCursorSpecial();
  268.          this.mainTimeline.stage.addEventListener(MouseEvent.MOUSE_MOVE,this.enterStage);
  269.       }
  270.       
  271.       public function enterStage(evt:MouseEvent) : void
  272.       {
  273.          trace("enterStage");
  274.          this.showCursorSpecial();
  275.          this.mainTimeline.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.enterStage);
  276.       }
  277.       
  278.       public function hideCursorSpecial() : void
  279.       {
  280.          trace("HIDE CURSEUR_TORCHE",this.CURSEUR_TORCHE);
  281.          if(this.CURSEUR_TORCHE !== null)
  282.          {
  283.             if(this.BT_RETOUR._gameOn == true)
  284.             {
  285.                Mouse.show();
  286.                this.CURSEUR_TORCHE = this.mainTimeline.CURSEUR_TORCHE;
  287.                this.CURSEUR_TORCHE.visible = false;
  288.             }
  289.          }
  290.       }
  291.       
  292.       public function label_05() : void
  293.       {
  294.          this.showCursorSpecial(1);
  295.          this.mainTimeline.stage.addEventListener(Event.MOUSE_LEAVE,this.leaveStage);
  296.          this.HERAKLES = new InteractiveMovie(this.mainTimeline["HERAKLES"],this._timelineManager);
  297.          this.HERAKLES.gotoAndPlayUntil({
  298.             "labelPlay":"E2",
  299.             "beforeLabelStop":"E3",
  300.             "callback":this.coupeTete
  301.          });
  302.          this._engine.playNoise(new NoiseObject({"code":"B_ATTAQUE"}));
  303.       }
  304.       
  305.       public function labelATTENTE_JEU() : void
  306.       {
  307.          trace("labelATTENTE_JEU");
  308.          this.HYDREdemo = new InteractiveMovie(this.mainTimeline["HYDRE_03"],this._timelineManager);
  309.          this.HYDREdemo.gotoAndStop("E1");
  310.          this.PANO_AIDE = this.mainTimeline.PANO_AIDE;
  311.          this.PANO_AIDE.visible = false;
  312.          this.BT_AIDE = new InteractiveMovie(this.mainTimeline["BT_AIDE"],this._timelineManager);
  313.          this.BT_AIDE.gotoAndStop("E1");
  314.          this.BT_REJOUER = new InteractiveMovie(this.mainTimeline["BT_REJOUER"],this._timelineManager);
  315.          this.BT_REJOUER.gotoAndStop("E1");
  316.          this.BT_REJOUER.mc.visible = false;
  317.          this.HERAKLES = new InteractiveMovie(this.mainTimeline["HERAKLES"],this._timelineManager);
  318.          this.HERAKLES.gotoAndStop("E1");
  319.          this.TIMER = new InteractiveMovie(this.mainTimeline["TIMER"],this._timelineManager);
  320.          this.TIMER.gotoAndStop(1);
  321.          this.TIMER.mc.pDoneSon = false;
  322.          this.label_01();
  323.          this.gListeDone = [0,0,0,0,0,0,0,0];
  324.          this.gListeTete = GlobalesFunctions.randomArrayFromXtoY(1,8);
  325.          trace("____________________gListeTete",this.gListeTete);
  326.          this.gCountTete = 0;
  327.          this.gCountSec = 0;
  328.          this.jeuPerdu = false;
  329.          this.timer_TOTAL.reset();
  330.          this.timer_TOTAL.start();
  331.          this._startTimeJEU = new Date().time;
  332.          this.heraklesAction(null);
  333.          this.initBT_AIDE();
  334.          this.BT_RETOUR._gameOn = true;
  335.          this.showCursorSpecial();
  336.       }
  337.       
  338.       public function initJEU() : void
  339.       {
  340.          var myMc:InteractiveMovie = new InteractiveMovie(this.HYDREteteActive.mc.COU,this._timelineManager);
  341.          myMc.gotoAndPlayUntilTheEnd(1);
  342.          myMc = new InteractiveMovie(this.HYDREteteActive.mc.COU.TETE,this._timelineManager);
  343.          myMc.mc.useHandCursor = false;
  344.          myMc.mc.onRollOver = function(p:Object):void
  345.          {
  346.             CURSEUR_TORCHE.alpha = 0.5;
  347.          };
  348.          myMc.mc.onRollOut = function(p:Object):void
  349.          {
  350.             CURSEUR_TORCHE.alpha = 1;
  351.          };
  352.          myMc.mc.onPress = function(p:Object):void
  353.          {
  354.             trace("useTorche",this.parent.parent.name);
  355.             _engine.playNoise(new NoiseObject({"code":"B_BRULE"}));
  356.             CURSEUR_TORCHE.alpha = 1;
  357.             timer_JEU.stop();
  358.             HYDREteteActive.gotoAndStop("E4");
  359.             gCountTete += 1;
  360.             trace("gCountTete",gCountTete);
  361.             gListeTete.splice(0,1);
  362.             trace("__________________gListeTete",gListeTete);
  363.             if(gListeTete.length == 0)
  364.             {
  365.                trace("gagne");
  366.                timer_TOTAL.stop();
  367.                timer_HERAKLES.stop();
  368.                timer_JEU.stop();
  369.                mainTimeline.removeEventListener(Event.ENTER_FRAME,enterFrame);
  370.                mainTimeline.stage.removeEventListener(Event.MOUSE_LEAVE,leaveStage);
  371.                hideCursorSpecial();
  372.                save();
  373.                BT_RETOUR._gameOn = false;
  374.                _timeline_.GotoAndPlayUntil({"labelStop":"_07"});
  375.             }
  376.             else
  377.             {
  378.                timer_HERAKLES.reset();
  379.                timer_HERAKLES.start();
  380.             }
  381.          };
  382.          myMc.activeMC();
  383.       }
  384.       
  385.       public function finSequenceJeu(evt:TimerEvent) : void
  386.       {
  387.          trace("timer_JEU.delay",this.timer_JEU.delay);
  388.          trace("fin TETE HYDRE",this.HYDREteteActive.mc.name);
  389.          var myMc:InteractiveMovie = new InteractiveMovie(this.HYDREteteActive.mc.COU.TETE,this._timelineManager);
  390.          myMc.kill();
  391.          myMc.mc.mouseEnabled = false;
  392.          myMc.mc.mousechildren = false;
  393.          this.timer_JEU.stop();
  394.          this.HYDREteteActive.gotoAndStop("E3");
  395.          this.gListeTete = GlobalesFunctions.randomArray(this.gListeTete);
  396.          this.timer_HERAKLES.reset();
  397.          this.timer_HERAKLES.start();
  398.       }
  399.       
  400.       public function heraklesAction(evt:TimerEvent) : void
  401.       {
  402.          trace("timer_HERAKLES.delay",this.timer_HERAKLES.delay);
  403.          trace("heraklesAction");
  404.          this.timer_HERAKLES.stop();
  405.          this.HERAKLES.gotoAndPlayUntil({
  406.             "labelPlay":"E2",
  407.             "beforeLabelStop":"E3",
  408.             "callback":this.coupeTeteAleatoire
  409.          });
  410.          this._engine.playNoise(new NoiseObject({"code":"B_ATTAQUE"}));
  411.       }
  412.       
  413.       public function refreshCouTete(evt:TimerEvent) : void
  414.       {
  415.          var myMc:InteractiveMovie = null;
  416.          this.gCountSecCouTete += 1;
  417.          var pCent:int = Math.floor(this.gCountSecCouTete / this.timeGame * 100);
  418.          trace("pCentCouTete",pCent);
  419.          if(pCent <= 100)
  420.          {
  421.             myMc = new InteractiveMovie(this.HYDREteteActive.mc.COU,this._timelineManager);
  422.             myMc.gotoAndStop(Math.floor(pCent));
  423.          }
  424.       }
  425.       
  426.       public function refreshTimer(evt:TimerEvent) : void
  427.       {
  428.          this.gCountSec += 1;
  429.          var pCent:int = Math.floor(this.gCountSec / this.timeTotal * 100);
  430.          trace("pCent",pCent);
  431.          if(pCent <= 100)
  432.          {
  433.             this.TIMER.gotoAndStop(pCent);
  434.             if(pCent >= 80 && this.TIMER.mc.pDoneSon == false)
  435.             {
  436.                this.TIMER.mc.pDoneSon = true;
  437.                this._engine.playNoise(new NoiseObject({"code":"B_TIME"}));
  438.             }
  439.          }
  440.       }
  441.       
  442.       public function finTimerJeu(evt:TimerEvent) : void
  443.       {
  444.          trace("timer_TOTAL.delay",this.timer_TOTAL.delay);
  445.          trace("_finTimeJEU",new Date().time - this._startTimeJEU);
  446.          this.hideCursorSpecial();
  447.          this.mainTimeline.stage.removeEventListener(Event.MOUSE_LEAVE,this.leaveStage);
  448.          this.jeuPerdu = true;
  449.          this.BT_RETOUR._gameOn = false;
  450.          this.timer_TOTAL.stop();
  451.          this.timer_HERAKLES.stop();
  452.          this.timer_JEU.stop();
  453.          this.HYDREteteActive.mc.mouseEnabled = false;
  454.          this.HYDREteteActive.mc.mouseChildren = false;
  455.          this._engine.playNoise(new NoiseObject({"code":"B_TIME_END"}));
  456.          this.mainTimeline.removeEventListener(Event.ENTER_FRAME,this.enterFrame);
  457.          this._timeline_.GotoAndPlayUntil({"labelStop":"PERDU"});
  458.       }
  459.       
  460.       public function labelPERDU() : void
  461.       {
  462.          this._engine.playComment(new CommentObject({"code":"PERDU"}));
  463.          var myMc:InteractiveMovie = this.BT_REJOUER;
  464.          myMc.mc.visible = true;
  465.          myMc.mc.pNoiseRoll = "B_REJ";
  466.          myMc.mc.onRollOver = function(p:Object):void
  467.          {
  468.             _engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
  469.          };
  470.          myMc.mc.onRollOut = function(p:Object):void
  471.          {
  472.             _engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
  473.          };
  474.          myMc.mc.onPress = function(p:Object):void
  475.          {
  476.             _engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
  477.             _timeline_.GotoAndPlayUntil({"labelStop":"ATTENTE_JEU"});
  478.          };
  479.          myMc.activeMC();
  480.       }
  481.       
  482.       public function initBT_AIDE() : void
  483.       {
  484.          var myMc:InteractiveMovie = null;
  485.          trace("initBT_AIDE");
  486.          myMc = this.BT_AIDE;
  487.          myMc.mc.pNoiseRoll = "B_AIDE";
  488.          myMc.mc.clicked = undefined;
  489.          myMc.mc.onRollOver = function(p:Object):void
  490.          {
  491.             trace("ROLL");
  492.             trace("BT_RETOUR._gameOn",BT_RETOUR._gameOn);
  493.             hideCursorSpecial();
  494.             _engine.playNoise(new NoiseObject({"code":this.pNoiseRoll}));
  495.          };
  496.          myMc.mc.onRollOut = function(p:Object):void
  497.          {
  498.             trace("OUT");
  499.             if(this.clicked == undefined)
  500.             {
  501.                showCursorSpecial();
  502.                _engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
  503.             }
  504.          };
  505.          myMc.mc.onPress = function(p:Object):void
  506.          {
  507.             var cz:Sprite = null;
  508.             trace("PRESS");
  509.             this.clicked = true;
  510.             BT_RETOUR._gameOn = false;
  511.             _engine.stopNoise(new NoiseObject({"code":this.pNoiseRoll}));
  512.             PANO_AIDE.visible = true;
  513.             sleepAIDE(false);
  514.             if(jeuPerdu == false)
  515.             {
  516.                _engine.playComment(new CommentObject({"code":"AIDE"}));
  517.                cz = GlobalesFunctions.createRectangle({
  518.                   "color":65280,
  519.                   "alpha":0
  520.                });
  521.                cz.addEventListener(MouseEvent.CLICK,function():void
  522.                {
  523.                   trace("clic retour au jeu");
  524.                   BT_RETOUR._gameOn = true;
  525.                   wakeAIDE();
  526.                   _engine.stopComment();
  527.                   cz.parent.removeChild(cz);
  528.                   PANO_AIDE.visible = false;
  529.                   myMc.mc.clicked = undefined;
  530.                });
  531.                _engine.config.layers["content"].addChild(cz);
  532.                cz.useHandCursor = true;
  533.                cz.visible = true;
  534.             }
  535.             else
  536.             {
  537.                _engine.playComment(new CommentObject({
  538.                   "code":"AIDE",
  539.                   "callback":cachePANO_AIDE
  540.                }));
  541.             }
  542.          };
  543.          myMc.activeMC();
  544.       }
  545.       
  546.       public function cachePANO_AIDE() : void
  547.       {
  548.          this.PANO_AIDE.visible = false;
  549.          this.wakeAIDE();
  550.       }
  551.       
  552.       public function G2D(value:int) : String
  553.       {
  554.          return GlobalesFunctions.gimme2digits(value);
  555.       }
  556.       
  557.       public function save() : void
  558.       {
  559.          this.BT_RETOUR._gameWon = true;
  560.          this.gListDone[this._engine.config.moduleNum - 1] = 1;
  561.          if(this.gDoneDepart)
  562.          {
  563.             this.so.data.lastDone = 2;
  564.          }
  565.          else
  566.          {
  567.             this.so.data.lastDone = 1;
  568.          }
  569.          this.so.data.listDone = this.gListDone;
  570.          this.so.flush();
  571.       }
  572.       
  573.       public function endMODULE() : void
  574.       {
  575.          trace("fin du module");
  576.          this.mainTimeline.stage.removeEventListener(MouseEvent.MOUSE_MOVE,this.enterStage);
  577.          this.mainTimeline.stage.removeEventListener(Event.MOUSE_LEAVE,this.leaveStage);
  578.          Mouse.show();
  579.          this._engine.host.changeModule({"numMod":0});
  580.       }
  581.       
  582.       public function sleepAIDE(coupeSon:Boolean = true) : void
  583.       {
  584.          this._pausedAIDE = true;
  585.          this.timer_TOTAL.pause();
  586.          this.timer_HERAKLES.pause();
  587.          this.timer_JEU.pause();
  588.          this.hideCursorSpecial();
  589.          this._pauseManager_ = new PauseManager(this._engine,this._timelineManager,coupeSon);
  590.          this._pauseManager_.sleepMovie(this.mainTimeline);
  591.       }
  592.       
  593.       public function wakeAIDE() : void
  594.       {
  595.          this._pausedAIDE = false;
  596.          this.timer_TOTAL.resume();
  597.          this.timer_HERAKLES.resume();
  598.          this.timer_JEU.resume();
  599.          this.showCursorSpecial();
  600.          this._pauseManager_.wakeMovie(this.mainTimeline);
  601.       }
  602.       
  603.       public function sleep(coupeSon:Boolean = true) : void
  604.       {
  605.          if(this._pausedAIDE == false)
  606.          {
  607.             this.timer_TOTAL.pause();
  608.             this.timer_HERAKLES.pause();
  609.             this.timer_JEU.pause();
  610.             this.hideCursorSpecial();
  611.          }
  612.          this._pauseManager = new PauseManager(this._engine,this._timelineManager,coupeSon);
  613.          this._pauseManager.sleepMovie(this.mainTimeline);
  614.       }
  615.       
  616.       public function wake() : void
  617.       {
  618.          if(this._pausedAIDE == false)
  619.          {
  620.             this.timer_TOTAL.resume();
  621.             this.timer_HERAKLES.resume();
  622.             this.timer_JEU.resume();
  623.             this.showCursorSpecial();
  624.          }
  625.          this._pauseManager.wakeMovie(this.mainTimeline);
  626.       }
  627.       
  628.       public function destroy() : void
  629.       {
  630.          this.timer_TOTAL.removeEventListener(TimerEvent.TIMER,this.refreshTimer);
  631.          this.timer_TOTAL.removeEventListener(TimerEvent.TIMER_COMPLETE,this.finTimerJeu);
  632.          this.timer_HERAKLES.removeEventListener(TimerEvent.TIMER,this.heraklesAction);
  633.          this.timer_JEU.removeEventListener(TimerEvent.TIMER,this.refreshCouTete);
  634.          this.timer_JEU.removeEventListener(TimerEvent.TIMER_COMPLETE,this.finSequenceJeu);
  635.          this.mainTimeline.removeEventListener(Event.ENTER_FRAME,this.enterFrame);
  636.          this._engine.stopAllSounds();
  637.          this._timeline_.kilListeners();
  638.       }
  639.    }
  640. }
  641.