home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 160 / MOBICLIC160.ISO / pc / DATA / DSS160 / DSS160_00 / DSS160_00.swf / scripts / dss160_00 / CapsuleAlgo.as
Encoding:
Text File  |  2013-12-16  |  32.3 KB  |  994 lines

  1. package dss160_00
  2. {
  3.    import com.milanpresse.engine.*;
  4.    import com.milanpresse.engine.initmovieclip.*;
  5.    import com.milanpresse.engine.managers.*;
  6.    import com.milanpresse.engine.medias.*;
  7.    import com.milanpresse.engine.timelines.*;
  8.    import com.milanpresse.engine.timers.ExtendedTimer;
  9.    import com.milanpresse.engine.typeargument.*;
  10.    import com.milanpresse.tools.GlobalesFunctions;
  11.    import flash.display.*;
  12.    import flash.events.TimerEvent;
  13.    import flash.net.*;
  14.    import flash.text.AntiAliasType;
  15.    import flash.text.TextField;
  16.    import flash.text.TextFormat;
  17.    import flash.text.TextFormatAlign;
  18.    
  19.    public class CapsuleAlgo
  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 saveClip:MediaSwf;
  48.       
  49.       private var saveTimeline:MovieClip;
  50.       
  51.       private var saveTl:Timeline;
  52.       
  53.       private var bulleRepriseMc:MovieClip;
  54.       
  55.       private var bulleNouvelleMc:MovieClip;
  56.       
  57.       private var question:int;
  58.       
  59.       private var myMc:MovieClip;
  60.       
  61.       private var myIm:InteractiveMovie;
  62.       
  63.       private var chatMc:MovieClip;
  64.       
  65.       private var chatIm:InteractiveMovie;
  66.       
  67.       private var timerMc:MovieClip;
  68.       
  69.       private var timerIm:InteractiveMovie;
  70.       
  71.       private var sandMc:MovieClip;
  72.       
  73.       private var sandIm:InteractiveMovie;
  74.       
  75.       private var bulleMc:MovieClip;
  76.       
  77.       private var bulleIm:InteractiveMovie;
  78.       
  79.       private var bulle2Mc:MovieClip;
  80.       
  81.       private var bulle2Im:InteractiveMovie;
  82.       
  83.       private var okAnnulMc:MovieClip;
  84.       
  85.       private var okAnnulIm:InteractiveMovie;
  86.       
  87.       private var okMc:MovieClip;
  88.       
  89.       private var okIm:InteractiveMovie;
  90.       
  91.       private var annulerMc:MovieClip;
  92.       
  93.       private var annulerIm:InteractiveMovie;
  94.       
  95.       private var zoneQMc:MovieClip;
  96.       
  97.       private var zoneQIm:InteractiveMovie;
  98.       
  99.       private var flecheGMc:MovieClip;
  100.       
  101.       private var flecheGIm:InteractiveMovie;
  102.       
  103.       private var flecheDMc:MovieClip;
  104.       
  105.       private var flecheDIm:InteractiveMovie;
  106.       
  107.       private var fondClicMc:MovieClip;
  108.       
  109.       private var fondClicIm:InteractiveMovie;
  110.       
  111.       private var listPersos:Array;
  112.       
  113.       private var listReponses:Array;
  114.       
  115.       private var nbPerso:int;
  116.       
  117.       private var perso:int;
  118.       
  119.       private var sandTimer:ExtendedTimer;
  120.       
  121.       private var J02Timer:ExtendedTimer;
  122.       
  123.       private var doneAide2:Boolean;
  124.       
  125.       private var doneAide34:Boolean;
  126.       
  127.       private var nbEliminated:int;
  128.       
  129.       private var lastStele:MovieClip;
  130.       
  131.       private var persoDone:Array;
  132.       
  133.       private var tourFait:Boolean;
  134.       
  135.       private var correctAnswer:Boolean;
  136.       
  137.       public function CapsuleAlgo(engine:Engine)
  138.       {
  139.          this.labelsCallback = {};
  140.          super();
  141.          this._engine = engine;
  142.          this._engine.playMusic({"code":"MU"});
  143.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  144.          this._engine.setFrameRate(12);
  145.          this.mainClip = this._engine.showSwf({
  146.             "code":"A_" + this._engine.config.moduleName,
  147.             "parent":this._engine.config.layers["content"]
  148.          });
  149.          this.mainTimeline = this.mainClip.swfContent;
  150.          this._timelineManager = new TimelineManager();
  151.          this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  152.          this._engine.levelCZ = this._engine.config.layers["content"];
  153.          this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
  154.          this.firstLabel = "WAIT_zanim00";
  155.          trace("so.size",this.so.size);
  156.          trace("so.data.ecranEnCours",this.so.data.ecranEnCours);
  157.          trace("so.data.etatJeux",this.so.data.etatJeux);
  158.          if(this.so.size == 0)
  159.          {
  160.             this.so.data.ecranEnCours = 0;
  161.             this.so.data.etatJeux = new Array(0,0,0,0);
  162.             this.so.flush();
  163.          }
  164.          if(this._engine.config.callerParameters.fromCodeRub == "MOB")
  165.          {
  166.             this.so.data.startAgain = undefined;
  167.          }
  168.          if(this.so.data.ecranEnCours == 0 && this.so.data.startAgain !== 1)
  169.          {
  170.             switch(this.so.data.etatJeux[0])
  171.             {
  172.                case 0:
  173.                   this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
  174.                   break;
  175.                default:
  176.                   this._timeline_.GotoAndStop(1);
  177.                   this.initEnregistrement();
  178.             }
  179.          }
  180.          else
  181.          {
  182.             this._timeline_.GotoAndStop(1);
  183.             this.initEnregistrement();
  184.          }
  185.       }
  186.       
  187.       private function initEnregistrement() : void
  188.       {
  189.          var stringMemo:String = null;
  190.          var myMc:InteractiveMovie = null;
  191.          stringMemo = this._engine.config.moduleName + "_MEMO";
  192.          this.saveClip = this._engine.showSwf({
  193.             "code":stringMemo,
  194.             "parent":this._engine.config.layers["content"]
  195.          });
  196.          this.saveTimeline = this.saveClip.swfContent;
  197.          this.saveTl = new Timeline(this.saveTimeline,this._timelineManager);
  198.          if(this.so.data.startAgain !== 1)
  199.          {
  200.             this.saveTl.GotoAndStop(1);
  201.             myMc = new InteractiveMovie(this.saveTimeline["BT_REPRISE"],this._timelineManager);
  202.             myMc.gotoAndStop(1);
  203.             myMc.mc.mcI = myMc;
  204.             this._engine.showLM({
  205.                "id":"LM_REPRISE",
  206.                "findModelIn":this.saveTimeline
  207.             });
  208.             myMc.mc.onRollOver = function(p:Object):void
  209.             {
  210.                this.mcI.gotoAndStop("E2");
  211.             };
  212.             myMc.mc.onRollOut = function(p:Object):void
  213.             {
  214.                this.mcI.gotoAndStop("E1");
  215.             };
  216.             myMc.mc.onPress = function(p:Object):void
  217.             {
  218.                this.kill();
  219.                if(so.data.ecranEnCours == 0)
  220.                {
  221.                   switch(so.data.etatJeux[0])
  222.                   {
  223.                      case 1:
  224.                         _timeline_.GotoAndPlayUntil({"labelStop":"ATTENTE_J_00"});
  225.                         break;
  226.                      case 2:
  227.                         _timeline_.GotoAndPlayUntil({"labelStop":"_16"});
  228.                   }
  229.                   _engine.hideSwf({"code":stringMemo});
  230.                }
  231.                else
  232.                {
  233.                   _engine.host.changeModule({"numMod":so.data.ecranEnCours});
  234.                }
  235.             };
  236.             myMc.activeMC();
  237.          }
  238.          else
  239.          {
  240.             this.saveTl.GotoAndStop("E2");
  241.          }
  242.          myMc = new InteractiveMovie(this.saveTimeline["BT_NEW"],this._timelineManager);
  243.          myMc.gotoAndStop(1);
  244.          myMc.mc.mcI = myMc;
  245.          this._engine.showLM({
  246.             "id":"LM_NEW",
  247.             "findModelIn":this.saveTimeline
  248.          });
  249.          myMc.mc.onRollOver = function(p:Object):void
  250.          {
  251.             this.mcI.gotoAndStop("E2");
  252.          };
  253.          myMc.mc.onRollOut = function(p:Object):void
  254.          {
  255.             this.mcI.gotoAndStop("E1");
  256.          };
  257.          myMc.mc.onPress = function(p:Object):void
  258.          {
  259.             this.kill();
  260.             so.clear();
  261.             so.data.ecranEnCours = 0;
  262.             so.data.etatJeux = new Array(0,0,0,0);
  263.             so.flush();
  264.             _engine.hideSwf({"code":stringMemo});
  265.             _timeline_.GotoAndPlayUntil({"labelStop":firstLabel});
  266.          };
  267.          myMc.activeMC();
  268.       }
  269.       
  270.       public function labelATTENTE_J_00() : void
  271.       {
  272.          this.so.data.etatJeux[0] = 1;
  273.          this.so.flush();
  274.          this.question = 1;
  275.          this.showQuestion(1);
  276.          this.initBTZap();
  277.          this._engine.playComment(new CommentObject({
  278.             "code":"J_00",
  279.             "callback":this._timeline_.nextLabel
  280.          }));
  281.       }
  282.       
  283.       public function labelATTENTE_J_02() : void
  284.       {
  285.          this.question = 2;
  286.          this.showQuestion(1);
  287.          this._engine.playComment(new CommentObject({
  288.             "code":"J_02",
  289.             "callback":this.suiteJ02
  290.          }));
  291.          this.J02Timer = new ExtendedTimer(2000);
  292.          this.J02Timer.addEventListener(TimerEvent.TIMER,this.demoQuestion);
  293.          this.J02Timer.start();
  294.       }
  295.       
  296.       private function demoQuestion(evt:TimerEvent) : void
  297.       {
  298.          this.question += 1;
  299.          if(this.question == 9)
  300.          {
  301.             this.question = 1;
  302.          }
  303.          this.showQuestion(1);
  304.       }
  305.       
  306.       private function suiteJ02() : void
  307.       {
  308.          this._timeline_.nextLabel();
  309.       }
  310.       
  311.       public function labelATTENTE_J_03() : void
  312.       {
  313.          this._engine.playComment(new CommentObject({
  314.             "code":"J_03",
  315.             "callback":this.suiteJ02
  316.          }));
  317.          this.J02Timer.removeEventListener(TimerEvent.TIMER,this.demoQuestion);
  318.          this.question = 2;
  319.          this.showQuestion(1);
  320.       }
  321.       
  322.       public function labelATTENTE() : void
  323.       {
  324.          this.doneAide2 = false;
  325.          this.doneAide34 = false;
  326.          this.listReponses = [[1,0,0,1,0,1,0,0],[0,1,1,0,0,0,1,0],[0,0,1,1,1,1,0,0],[1,1,0,0,1,0,1,1],[0,0,1,0,1,0,0,0],[1,0,0,0,0,0,0,1]];
  327.          this.listPersos = GlobalesFunctions.randomArrayFromXtoY(1,6);
  328.          trace("listPersos",this.listPersos);
  329.          this.persoDone = [0,0,0,0,0,0];
  330.          this.nbPerso = 0;
  331.          this.tourFait = false;
  332.          this.question = 1;
  333.          this.showQuestion(0);
  334.          this.initChat();
  335.          this.initTimer();
  336.          this.initAide();
  337.          this.initValidAnnul();
  338.          this.initZoneQ();
  339.          this.initPersos();
  340.          this.initZoneP();
  341.          this.initFleches();
  342.          this.initFondClic();
  343.          this.initPerso();
  344.          this.initLM();
  345.          this.nbEliminated = 0;
  346.          this.afficheAide(1,570,190);
  347.       }
  348.       
  349.       private function initLM() : void
  350.       {
  351.          var textHolder:MovieClip = null;
  352.          for(var i:int = 1; i <= 6; i++)
  353.          {
  354.             textHolder = this.mainTimeline["LM_P_" + this.G2D(i)];
  355.             textHolder.visible = false;
  356.          }
  357.       }
  358.       
  359.       private function showQuestion(onIntro:int) : void
  360.       {
  361.          var textHolder:MovieClip = null;
  362.          if(onIntro == 1)
  363.          {
  364.             textHolder = this.mainTimeline.LM_QUESTION;
  365.          }
  366.          else
  367.          {
  368.             textHolder = this.mainTimeline.ZONE_QUESTION.LM_QUESTION;
  369.          }
  370.          for(var i:int = 0; i < textHolder.numChildren; i++)
  371.          {
  372.             if(textHolder.getChildAt(i).name == "TEXT")
  373.             {
  374.                textHolder.removeChildAt(i);
  375.             }
  376.          }
  377.          var id:String = "LM_Q_" + GlobalesFunctions.gimme2digits(this.question);
  378.          var questionText:String = this._engine.config.texteManager.getTexteByID(id);
  379.          var textfield:TextField = new TextField();
  380.          textfield.name = "TEXT";
  381.          textfield.width = textHolder.width;
  382.          textfield.thickness = 0;
  383.          textfield.text = questionText;
  384.          textfield.embedFonts = true;
  385.          textfield.antiAliasType = AntiAliasType.ADVANCED;
  386.          textfield.selectable = false;
  387.          var textFormat:TextFormat = new TextFormat("Arcena",20,10596,null,null,null,null,null,TextFormatAlign.CENTER,null,null,null,1);
  388.          textfield.setTextFormat(textFormat);
  389.          textHolder.addChild(textfield);
  390.       }
  391.       
  392.       private function initChat() : void
  393.       {
  394.          this.chatMc = this.mainTimeline.CHAT;
  395.          this.chatIm = new InteractiveMovie(this.chatMc,this._timelineManager);
  396.          this.chatIm.gotoAndStop("E1");
  397.       }
  398.       
  399.       private function initTimer() : void
  400.       {
  401.          this.timerMc = this.mainTimeline.TIMER;
  402.          this.timerIm = new InteractiveMovie(this.timerMc,this._timelineManager);
  403.          this.timerIm.gotoAndStop("E1");
  404.          this.sandMc = this.timerMc.SAND;
  405.          this.sandIm = new InteractiveMovie(this.sandMc,this._timelineManager);
  406.          this.sandIm.gotoAndStop(1);
  407.          this.sandTimer = new ExtendedTimer(1500);
  408.          this.sandTimer.addEventListener(TimerEvent.TIMER,this.sandsOfTime);
  409.          this.sandTimer.start();
  410.       }
  411.       
  412.       private function sandsOfTime(evt:TimerEvent) : void
  413.       {
  414.          this.sandIm.gotoAndStop(this.sandIm.mc.currentFrame + 1);
  415.          if(this.sandIm.mc.currentFrame == this.sandIm.mc.totalFrames)
  416.          {
  417.             this.correctAnswer = false;
  418.             this.hideAide();
  419.             this.hideValider();
  420.             this.sandTimer.removeEventListener(TimerEvent.TIMER,this.sandsOfTime);
  421.             this.killJeu();
  422.             this.timerIm.gotoAndStop("E2");
  423.             this._engine.playNoise(new NoiseObject({"code":"B_TIME"}));
  424.             this._engine.playComment(new CommentObject({
  425.                "code":"E_04",
  426.                "callback":this.restartJeu
  427.             }));
  428.             this.chatIm.gotoAndStop("E2");
  429.          }
  430.       }
  431.       
  432.       private function killJeu() : void
  433.       {
  434.          this.chatIm.gotoAndStop("E1");
  435.          this.zoneQIm.desactive();
  436.          this.flecheDIm.desactive();
  437.          this.flecheGIm.desactive();
  438.          for(var i:int = 1; i <= 24; i++)
  439.          {
  440.             this.myMc = this.mainTimeline["PERSO_" + this.G2D(i)];
  441.             this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  442.             this.myIm.desactive();
  443.          }
  444.       }
  445.       
  446.       private function restartJeu() : void
  447.       {
  448.          var i:int = 0;
  449.          if(this.correctAnswer)
  450.          {
  451.             this.myMc = this.mainTimeline["ZONE_P_" + this.G2D(this.perso)];
  452.             this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  453.             this.myIm.gotoAndStop("E2");
  454.             this.myMc = this.mainTimeline["ZONE_P_" + this.G2D(this.perso)].ANIM.ANIM;
  455.             this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  456.             this.myIm.gotoAndStop(1);
  457.          }
  458.          this.initPersos();
  459.          this.sandIm.gotoAndStop(1);
  460.          this.chatIm.gotoAndStop("E2");
  461.          if(this.persoDone.indexOf(0) == -1)
  462.          {
  463.             this.so.data.etatJeux[0] = 2;
  464.             this.so.flush();
  465.             this._engine.playComment(new CommentObject({
  466.                "code":"J_GAGNE",
  467.                "callback":this.suiteZap
  468.             }));
  469.             for(i = 1; i <= 6; i++)
  470.             {
  471.                this.myMc = this.mainTimeline["ZONE_P_" + this.G2D(i)];
  472.                this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  473.                this.myIm.gotoAndStop("E3");
  474.                this.myMc = this.mainTimeline["ZONE_P_" + this.G2D(i)].ANIM.ANIM;
  475.                this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  476.                this.myIm.gotoAndStop("E5");
  477.             }
  478.          }
  479.          else
  480.          {
  481.             if(this.nbPerso == 6 && this.tourFait == false)
  482.             {
  483.                trace("TOURFAIT");
  484.                trace("persoDone",this.persoDone);
  485.                this.tourFait = true;
  486.             }
  487.             this.nbEliminated = 0;
  488.             this.initPerso();
  489.             this._engine.playComment(new CommentObject({
  490.                "code":"J_SUITE",
  491.                "callback":this.nextPerso
  492.             }));
  493.          }
  494.       }
  495.       
  496.       private function nextPerso() : void
  497.       {
  498.          this.stopChat();
  499.          this.initTimer();
  500.       }
  501.       
  502.       private function initAide() : void
  503.       {
  504.          this.bulleMc = this.mainTimeline.BULLE_AIDE;
  505.          this.bulleIm = new InteractiveMovie(this.bulleMc,this._timelineManager);
  506.          this.bulleMc.visible = false;
  507.          this.bulle2Mc = this.mainTimeline.BULLE_AIDE_02;
  508.          this.bulle2Im = new InteractiveMovie(this.bulle2Mc,this._timelineManager);
  509.          this.bulle2Mc.visible = false;
  510.       }
  511.       
  512.       private function initValidAnnul() : void
  513.       {
  514.          this.okAnnulMc = this.mainTimeline.BULLE_AIDE_BT;
  515.          this.okAnnulIm = new InteractiveMovie(this.okAnnulMc,this._timelineManager);
  516.          this.okAnnulMc.visible = false;
  517.          this.okMc = this.okAnnulMc.BT_VALIDER;
  518.          this.okIm = new InteractiveMovie(this.okMc,this._timelineManager);
  519.          this.okIm.gotoAndStop(1);
  520.          this.okIm.mc.onRollOver = function(p:Object):void
  521.          {
  522.             _engine.playNoise(new NoiseObject({"code":"B_OK_01"}));
  523.             this.gotoAndStop("E2");
  524.          };
  525.          this.okIm.mc.onRollOut = function(p:Object):void
  526.          {
  527.             _engine.stopNoise(new NoiseObject({"code":"B_OK_01"}));
  528.             this.gotoAndStop("E1");
  529.          };
  530.          this.okIm.mc.onPress = function(p:Object):void
  531.          {
  532.             killJeu();
  533.             sandTimer.removeEventListener(TimerEvent.TIMER,sandsOfTime);
  534.             _engine.stopNoise(new NoiseObject({"code":"B_OK_01"}));
  535.             _engine.playNoise(new NoiseObject({"code":"B_OK_02"}));
  536.             hideValider();
  537.             trace("perso",perso,lastStele.perso);
  538.             if(perso == lastStele.perso)
  539.             {
  540.                _engine.playNoise(new NoiseObject({
  541.                   "code":"B_GOOD",
  542.                   "callback":suiteOK
  543.                }));
  544.                myMc = mainTimeline["ZONE_P_" + G2D(perso)];
  545.                myIm = new InteractiveMovie(myMc,_timelineManager);
  546.                myIm.gotoAndStop("E2");
  547.                myMc = mainTimeline["ZONE_P_" + G2D(perso)].ANIM.ANIM;
  548.                myIm = new InteractiveMovie(myMc,_timelineManager);
  549.                myIm.gotoAndStop(1);
  550.             }
  551.             else
  552.             {
  553.                _engine.playNoise(new NoiseObject({
  554.                   "code":"B_BAD",
  555.                   "callback":suiteBad
  556.                }));
  557.             }
  558.          };
  559.          this.okIm.activeMC();
  560.          this.annulerMc = this.okAnnulMc.BT_ANNUL;
  561.          this.annulerIm = new InteractiveMovie(this.annulerMc,this._timelineManager);
  562.          this.annulerIm.gotoAndStop(1);
  563.          this.annulerIm.mc.onRollOver = function(p:Object):void
  564.          {
  565.             _engine.playNoise(new NoiseObject({"code":"B_ANNUL"}));
  566.             this.gotoAndStop("E2");
  567.          };
  568.          this.annulerIm.mc.onRollOut = function(p:Object):void
  569.          {
  570.             _engine.stopNoise(new NoiseObject({"code":"B_ANNUL"}));
  571.             this.gotoAndStop("E1");
  572.          };
  573.          this.annulerIm.mc.onPress = function(p:Object):void
  574.          {
  575.             _engine.stopNoise(new NoiseObject({"code":"B_ANNUL"}));
  576.             hideValider();
  577.          };
  578.          this.annulerIm.activeMC();
  579.       }
  580.       
  581.       private function suiteOK() : void
  582.       {
  583.          var textHolder:MovieClip = null;
  584.          this.correctAnswer = true;
  585.          this.myMc = this.mainTimeline["ZONE_P_" + this.G2D(this.perso)];
  586.          this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  587.          this.myIm.gotoAndStop("E3");
  588.          this.myMc = this.mainTimeline["ZONE_P_" + this.G2D(this.perso)].ANIM.ANIM;
  589.          this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  590.          this.myIm.gotoAndStop(1);
  591.          textHolder = this.mainTimeline["LM_P_" + this.G2D(this.perso)];
  592.          textHolder.visible = true;
  593.          this.chatIm.gotoAndStop("E2");
  594.          this._engine.playComment(new CommentObject({
  595.             "code":"S_" + this.G2D(this.perso),
  596.             "callback":this.restartJeu
  597.          }));
  598.          this.persoDone[this.nbPerso - 1] = 1;
  599.          trace("persoDone",this.persoDone);
  600.       }
  601.       
  602.       private function suiteBad() : void
  603.       {
  604.          this.correctAnswer = false;
  605.          var myEchec:int = int(GlobalesFunctions.randomInt(1,3));
  606.          this.chatIm.gotoAndStop("E2");
  607.          this._engine.playComment(new CommentObject({
  608.             "code":"E_" + this.G2D(myEchec),
  609.             "callback":this.restartJeu
  610.          }));
  611.       }
  612.       
  613.       private function afficheAide(myAide:int, myX:int, myY:int) : void
  614.       {
  615.          var textHolder:MovieClip = null;
  616.          if(myAide == 4)
  617.          {
  618.             textHolder = this.mainTimeline.BULLE_AIDE_02.LM_AIDE;
  619.          }
  620.          else
  621.          {
  622.             textHolder = this.mainTimeline.BULLE_AIDE.LM_AIDE;
  623.          }
  624.          for(var i:int = 0; i < textHolder.numChildren; i++)
  625.          {
  626.             if(textHolder.getChildAt(i).name == "TEXT")
  627.             {
  628.                textHolder.removeChildAt(i);
  629.             }
  630.          }
  631.          var id:String = "LM_AIDE_" + GlobalesFunctions.gimme2digits(myAide);
  632.          var aideText:String = this._engine.config.texteManager.getTexteByID(id);
  633.          var textfield:TextField = new TextField();
  634.          textfield.name = "TEXT";
  635.          textfield.width = textHolder.width;
  636.          textfield.thickness = 0;
  637.          textfield.text = aideText;
  638.          textfield.embedFonts = true;
  639.          textfield.antiAliasType = AntiAliasType.ADVANCED;
  640.          textfield.selectable = false;
  641.          textfield.wordWrap = true;
  642.          var textFormat:TextFormat = new TextFormat("Arcena",14,7149611,null,null,null,null,null,TextFormatAlign.CENTER,null,null,null,1);
  643.          textfield.setTextFormat(textFormat);
  644.          textHolder.addChild(textfield);
  645.          if(myAide == 4)
  646.          {
  647.             this.bulle2Mc.visible = true;
  648.             this.bulle2Mc.x = myX;
  649.             this.bulle2Mc.y = myY;
  650.          }
  651.          else
  652.          {
  653.             this.bulleMc.visible = true;
  654.             this.bulleMc.x = myX;
  655.             this.bulleMc.y = myY;
  656.          }
  657.       }
  658.       
  659.       private function hideAide() : void
  660.       {
  661.          this.bulleMc.visible = false;
  662.          this.bulle2Mc.visible = false;
  663.       }
  664.       
  665.       private function initZoneQ() : void
  666.       {
  667.          this.zoneQMc = this.mainTimeline.ZONE_QUESTION;
  668.          this.zoneQIm = new InteractiveMovie(this.zoneQMc,this._timelineManager);
  669.          this.zoneQIm.gotoAndStop(1);
  670.          this.zoneQIm.mc.mcI = this.zoneQMc;
  671.          this.zoneQIm.mc.onRollOver = function(p:Object):void
  672.          {
  673.             _engine.playNoise(new NoiseObject({"code":"B_QUESTION"}));
  674.             this.mcI.gotoAndStop("E2");
  675.          };
  676.          this.zoneQIm.mc.onRollOut = function(p:Object):void
  677.          {
  678.             _engine.stopNoise(new NoiseObject({"code":"B_QUESTION"}));
  679.             this.mcI.gotoAndStop("E1");
  680.          };
  681.          this.zoneQIm.mc.onPress = function(p:Object):void
  682.          {
  683.             this.mcI.gotoAndStop("E3");
  684.             this.desactive();
  685.             _engine.playNoise(new NoiseObject({"code":"B_CLIC"}));
  686.             flecheDIm.desactive();
  687.             flecheGIm.desactive();
  688.             askCat();
  689.             hideAide();
  690.          };
  691.          this.zoneQIm.activeMC();
  692.       }
  693.       
  694.       private function askCat() : void
  695.       {
  696.          var catReponse:int = 0;
  697.          catReponse = int(this.listReponses[this.perso - 1][this.question - 1]);
  698.          if(catReponse == 1)
  699.          {
  700.             this._engine.playNoise(new NoiseObject({
  701.                "code":"B_OUI",
  702.                "callback":this.suiteCat
  703.             }));
  704.             this.chatIm.mc.gotoAndStop("E3");
  705.          }
  706.          else
  707.          {
  708.             this._engine.playNoise(new NoiseObject({
  709.                "code":"B_NON",
  710.                "callback":this.suiteCat
  711.             }));
  712.             this.chatIm.mc.gotoAndStop("E4");
  713.          }
  714.       }
  715.       
  716.       private function suiteCat() : void
  717.       {
  718.          this.stopChat();
  719.          if(!this.doneAide2)
  720.          {
  721.             this.doneAide2 = true;
  722.             this.afficheAide(2,650,370);
  723.          }
  724.       }
  725.       
  726.       private function stopChat() : void
  727.       {
  728.          this.zoneQIm.active();
  729.          this.flecheDIm.active();
  730.          this.flecheGIm.active();
  731.          this.zoneQIm.mc.gotoAndStop("E1");
  732.          this.chatIm.mc.gotoAndStop("E1");
  733.       }
  734.       
  735.       private function initPersos() : void
  736.       {
  737.          var i:int;
  738.          for(i = 1; i <= 24; i++)
  739.          {
  740.             this.myMc = this.mainTimeline["PERSO_" + this.G2D(i)];
  741.             this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  742.             this.myIm.active();
  743.             this.myIm.gotoAndStop(1);
  744.             this.myIm.mc.eliminated = false;
  745.             this.myIm.mc.perso = i;
  746.             this.myIm.mc.onRollOver = function(p:Object):void
  747.             {
  748.                if(!this.eliminated)
  749.                {
  750.                   this.gotoAndStop("E2");
  751.                }
  752.                else
  753.                {
  754.                   this.gotoAndStop("E4");
  755.                }
  756.             };
  757.             this.myIm.mc.onRollOut = function(p:Object):void
  758.             {
  759.                if(!this.eliminated)
  760.                {
  761.                   this.gotoAndStop("E1");
  762.                }
  763.                else
  764.                {
  765.                   this.gotoAndStop("E3");
  766.                }
  767.             };
  768.             this.myIm.mc.onPress = function(p:Object):void
  769.             {
  770.                var myX:int = 0;
  771.                if(!this.eliminated)
  772.                {
  773.                   hideAide();
  774.                   if(!doneAide34)
  775.                   {
  776.                      doneAide34 = true;
  777.                      if(this.x > 680)
  778.                      {
  779.                         myX = 680;
  780.                      }
  781.                      else
  782.                      {
  783.                         myX = int(this.x);
  784.                      }
  785.                      afficheAide(4,myX,this.y - 70);
  786.                      if(this.x < 400)
  787.                      {
  788.                         afficheAide(3,585,185);
  789.                      }
  790.                      else
  791.                      {
  792.                         afficheAide(3,206,185);
  793.                      }
  794.                   }
  795.                   _engine.playNoise(new NoiseObject({"code":"B_SUP"}));
  796.                   this.gotoAndStop("E3");
  797.                   this.eliminated = true;
  798.                   nbEliminated += 1;
  799.                   doneAide2 = true;
  800.                }
  801.                else
  802.                {
  803.                   hideAide();
  804.                   _engine.playNoise(new NoiseObject({"code":"B_AFF"}));
  805.                   this.gotoAndStop("E1");
  806.                   this.eliminated = false;
  807.                   nbEliminated -= 1;
  808.                }
  809.                if(nbEliminated == 23)
  810.                {
  811.                   showValider();
  812.                }
  813.                else
  814.                {
  815.                   hideValider();
  816.                }
  817.             };
  818.             this.myIm.activeMC();
  819.          }
  820.       }
  821.       
  822.       private function showValider() : void
  823.       {
  824.          for(var i:int = 1; i <= 24; i++)
  825.          {
  826.             this.myMc = this.mainTimeline["PERSO_" + this.G2D(i)];
  827.             if(this.myMc.eliminated == false)
  828.             {
  829.                this.lastStele = this.myMc;
  830.                break;
  831.             }
  832.          }
  833.          this.okAnnulMc.visible = true;
  834.          this.okAnnulMc.x = this.lastStele.x;
  835.          this.okAnnulMc.y = this.lastStele.y - 80;
  836.       }
  837.       
  838.       private function hideValider() : void
  839.       {
  840.          this.okAnnulMc.visible = false;
  841.       }
  842.       
  843.       private function initZoneP() : void
  844.       {
  845.          for(var i:int = 1; i <= 6; i++)
  846.          {
  847.             this.myMc = this.mainTimeline["ZONE_P_" + this.G2D(i)];
  848.             this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  849.             this.myIm.gotoAndStop(1);
  850.          }
  851.       }
  852.       
  853.       private function initFleches() : void
  854.       {
  855.          this.flecheGMc = this.mainTimeline["FLE_G"];
  856.          this.flecheGIm = new InteractiveMovie(this.flecheGMc,this._timelineManager);
  857.          this.flecheGIm.gotoAndStop(1);
  858.          this.flecheGIm.mc.onPress = function(p:Object):void
  859.          {
  860.             _engine.playNoise(new NoiseObject({"code":"B_FLE_G"}));
  861.             question -= 1;
  862.             if(question == 0)
  863.             {
  864.                question = 8;
  865.             }
  866.             showQuestion(0);
  867.             hideAide();
  868.          };
  869.          this.flecheGIm.activeMC();
  870.          this.flecheDMc = this.mainTimeline["FLE_D"];
  871.          this.flecheDIm = new InteractiveMovie(this.flecheDMc,this._timelineManager);
  872.          this.flecheDIm.gotoAndStop(1);
  873.          this.flecheDIm.mc.onPress = function(p:Object):void
  874.          {
  875.             _engine.playNoise(new NoiseObject({"code":"B_FLE_D"}));
  876.             question += 1;
  877.             if(question == 9)
  878.             {
  879.                question = 1;
  880.             }
  881.             showQuestion(0);
  882.             hideAide();
  883.          };
  884.          this.flecheDIm.activeMC();
  885.       }
  886.       
  887.       private function initFondClic() : void
  888.       {
  889.          this.fondClicMc = this.mainTimeline.FOND_CLIC;
  890.          this.fondClicIm = new InteractiveMovie(this.fondClicMc,this._timelineManager);
  891.          this.fondClicIm.mc.onPress = function(p:Object):void
  892.          {
  893.             hideAide();
  894.          };
  895.          this.fondClicIm.activeMC();
  896.          this.fondClicIm.mc.useHandCursor = false;
  897.       }
  898.       
  899.       private function initPerso() : void
  900.       {
  901.          trace("listPersos",this.listPersos);
  902.          if(this.tourFait)
  903.          {
  904.             this.nbPerso = GlobalesFunctions.randomInt(1,6);
  905.             while(this.persoDone[this.nbPerso - 1] == 1)
  906.             {
  907.                this.nbPerso = GlobalesFunctions.randomInt(1,6);
  908.             }
  909.          }
  910.          else
  911.          {
  912.             this.nbPerso += 1;
  913.          }
  914.          trace("nbPerso",this.nbPerso);
  915.          this.perso = this.listPersos[this.nbPerso - 1];
  916.          trace("perso ├á trouver",this.perso);
  917.       }
  918.       
  919.       private function initBTZap() : void
  920.       {
  921.          this.myMc = this.mainTimeline.BT_ZAP;
  922.          this.myIm = new InteractiveMovie(this.myMc,this._timelineManager);
  923.          this.myIm.gotoAndStop(1);
  924.          this.myIm.mc.onRollOver = function(p:Object):void
  925.          {
  926.             _engine.playNoise(new NoiseObject({"code":"B_ZAP"}));
  927.             _engine.showIB({
  928.                "id":"IB_ZAP",
  929.                "x":this.x,
  930.                "y":this.y + 25
  931.             });
  932.          };
  933.          this.myIm.mc.onRollOut = function(p:Object):void
  934.          {
  935.             _engine.hideIB();
  936.          };
  937.          this.myIm.mc.onPress = function(p:Object):void
  938.          {
  939.             so.data.etatJeux[0] = 2;
  940.             so.flush();
  941.             killJeu();
  942.             chatIm.gotoAndStop("E2");
  943.             _engine.playComment(new CommentObject({
  944.                "code":"J_PASSE",
  945.                "callback":suiteZap
  946.             }));
  947.          };
  948.          this.myIm.activeMC();
  949.       }
  950.       
  951.       public function suiteZap() : void
  952.       {
  953.          this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_transition"});
  954.       }
  955.       
  956.       public function G2D(value:int) : String
  957.       {
  958.          return GlobalesFunctions.gimme2digits(value);
  959.       }
  960.       
  961.       private function goNextModule() : void
  962.       {
  963.       }
  964.       
  965.       public function endMODULE() : void
  966.       {
  967.          trace("fin du module");
  968.          this.so.data.ecranEnCours = 1;
  969.          this._engine.host.changeModule({"numMod":this.so.data.ecranEnCours});
  970.       }
  971.       
  972.       public function sleep() : void
  973.       {
  974.          this._pauseManager = new PauseManager(this._engine,this._timelineManager);
  975.          this._pauseManager.sleepMovie(this.mainTimeline);
  976.       }
  977.       
  978.       public function wake() : void
  979.       {
  980.          if(this._pauseManager != null)
  981.          {
  982.             this._pauseManager.wakeMovie(this.mainTimeline);
  983.          }
  984.       }
  985.       
  986.       public function destroy() : void
  987.       {
  988.          this._engine.stopAllSounds();
  989.          this._timeline_.kilListeners();
  990.       }
  991.    }
  992. }
  993.  
  994.