home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 149 / MOBICLIC149.ISO / pc / DATA / DSS149 / DSS149_01 / DSS149_01.swf / scripts / dss149_01 / CapsuleAlgo.as < prev   
Text File  |  2012-11-21  |  28KB  |  745 lines

  1. package dss149_01
  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 animMc:MovieClip;
  48.       
  49.       private var animTl:Timeline;
  50.       
  51.       private var doneZones:Array;
  52.       
  53.       private var chandaMc:InteractiveMovie;
  54.       
  55.       private var BT_OK:InteractiveMovie;
  56.       
  57.       private var vigOrder:Array;
  58.       
  59.       private var listCibles:Array;
  60.       
  61.       private var gDrag:MovieClip = null;
  62.       
  63.       private var cibleFound:int;
  64.       
  65.       private var animEtape:int;
  66.       
  67.       private var gLastVIG:MovieClip;
  68.       
  69.       private var portrait:MovieClip;
  70.       
  71.       private var countGardes:int;
  72.       
  73.       private var listeRolledVIG:Array;
  74.       
  75.       public function CapsuleAlgo(engine:Engine)
  76.       {
  77.          this.labelsCallback = {
  78.             "ATTENTE_01":this.attente01,
  79.             "ATTENTE_02":this.attente02,
  80.             "_03":this.anim03,
  81.             "ATTENTE_03":this.attente03,
  82.             "_JEU01_01":this.initJeu01,
  83.             "ATTENTE_04":this.attente04,
  84.             "ANIM_GAGNE":this.suiteAnimGagne
  85.          };
  86.          super();
  87.          this._engine = engine;
  88.          this._engine.playMusic({"code":"MU"});
  89.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  90.          this._engine.setFrameRate(12);
  91.          this.mainClip = this._engine.showSwf({
  92.             "code":"A_" + this._engine.config.moduleName,
  93.             "parent":this._engine.config.layers["content"]
  94.          });
  95.          trace("mainClip",this.mainClip);
  96.          this.mainTimeline = this.mainClip.swfContent;
  97.          trace("mainTimeline",this.mainTimeline);
  98.          this._timelineManager = new TimelineManager();
  99.          this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  100.          this._engine.levelCZ = this._engine.config.layers["content"];
  101.          this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
  102.          trace("so.data.etatJeux",this.so.data.etatJeux);
  103.          this.so.data.ecranEnCours = 1;
  104.          this.so.flush();
  105.          switch(this.so.data.etatJeux[this._engine.config.moduleNum - 1])
  106.          {
  107.             case 0:
  108.                this.firstLabel = this.mainTimeline.currentLabels[0].name;
  109.                break;
  110.             case 1:
  111.                this.firstLabel = "_24";
  112.          }
  113.          this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
  114.       }
  115.       
  116.       private function attente01() : void
  117.       {
  118.          trace("MALLE MALLE");
  119.          this.mainTimeline.INTER_MALLE.TROUSSEAU.visible = false;
  120.          var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.INTER_MALLE.MALLE,this._timelineManager);
  121.          myMc.gotoAndStop(1);
  122.          myMc.mc.mcI = myMc;
  123.          myMc.mc.onRollOver = function(p:Object):void
  124.          {
  125.             this.mcI.gotoAndStop("E2");
  126.          };
  127.          myMc.mc.onRollOut = function(p:Object):void
  128.          {
  129.             this.mcI.gotoAndStop(1);
  130.          };
  131.          myMc.mc.onPress = function(p:Object):void
  132.          {
  133.             this.mcI.gotoAndStop("E3");
  134.             _engine.playNoise(new NoiseObject({"code":"B_MALLE"}));
  135.             this.enabled = false;
  136.             this.buttonMode = false;
  137.             mainTimeline.INTER_MALLE.TROUSSEAU.visible = true;
  138.             _engine.playComment(new CommentObject({
  139.                "code":"INT_01_02",
  140.                "callback":activateKeys
  141.             }));
  142.          };
  143.          myMc.activeMC();
  144.       }
  145.       
  146.       private function activateKeys() : void
  147.       {
  148.          var countTries:int = 0;
  149.          var myMc:InteractiveMovie = null;
  150.          countTries = 0;
  151.          for(var i:int = 1; i <= 10; i++)
  152.          {
  153.             myMc = new InteractiveMovie(this.mainTimeline.INTER_MALLE.TROUSSEAU["CLE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  154.             myMc.gotoAndStop(1);
  155.             myMc.mc.cle = i;
  156.             myMc.mc.onPress = function(p:Object):void
  157.             {
  158.                if(this.cle == 1)
  159.                {
  160.                   _timeline_.nextLabel();
  161.                }
  162.                else
  163.                {
  164.                   _engine.playNoise(new NoiseObject({"code":"B_NO"}));
  165.                   countTries += 1;
  166.                   if(countTries == 3)
  167.                   {
  168.                      _engine.playComment(new CommentObject({"code":"INT_01_03"}));
  169.                   }
  170.                }
  171.             };
  172.             myMc.activeMC();
  173.          }
  174.       }
  175.       
  176.       private function attente02() : void
  177.       {
  178.          var myMc:InteractiveMovie = new InteractiveMovie(this.mainTimeline.DANSEUSE,this._timelineManager);
  179.          myMc.gotoAndStop(1);
  180.          myMc.mc.rollOverFrame = "E1";
  181.          myMc.mc.mcI = myMc;
  182.          myMc.mc.onRollOver = function(p:Object):void
  183.          {
  184.             _engine.playNoise(new NoiseObject({"code":"B_FILLE"}));
  185.          };
  186.          myMc.mc.onRollOut = function(p:Object):void
  187.          {
  188.             _engine.stopNoise(new NoiseObject({"code":"B_FILLE"}));
  189.          };
  190.          myMc.mc.onPress = function(p:Object):void
  191.          {
  192.             _engine.stopNoise(new NoiseObject({"code":"B_FILLE"}));
  193.             this.mcI.gotoAndStop("E2");
  194.             animMc = this.ANIM;
  195.             animTl = new Timeline(animMc,_timelineManager);
  196.             animTl.GotoAndPlayUntilTheEnd(1,_timeline_.nextLabel);
  197.             this.enabled = false;
  198.             this.buttonMode = false;
  199.          };
  200.          myMc.activeMC();
  201.       }
  202.       
  203.       private function anim03() : void
  204.       {
  205.          this._engine.playComment(new CommentObject({
  206.             "code":"03",
  207.             "zapBlock":"NOZAP_NOBLOCK"
  208.          }));
  209.          this.animMc = this.mainTimeline.ANIM_03.CHARETTE;
  210.          this.animTl = new Timeline(this.animMc,this._timelineManager);
  211.          this.animTl.GotoAndPlayUntilTheEnd(1,this._timeline_.nextLabel);
  212.       }
  213.       
  214.       public function label_15() : void
  215.       {
  216.          var anim15_Tl:Timeline = new Timeline(this.mainTimeline.anim.PRIEUR.TETE,this._timelineManager);
  217.          anim15_Tl.GotoAndStop(1);
  218.       }
  219.       
  220.       private function attente03() : void
  221.       {
  222.          var myMc:InteractiveMovie = null;
  223.          if(this.doneZones == null)
  224.          {
  225.             this.doneZones = new Array(0,0,0,0,0);
  226.          }
  227.          for(var i:int = 1; i <= 5; i++)
  228.          {
  229.             myMc = new InteractiveMovie(this.mainTimeline.ZONES["ZONE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  230.             myMc.gotoAndStop(1);
  231.             myMc.mc.zone = i;
  232.             if(this.doneZones[i - 1] !== 0)
  233.             {
  234.                myMc.gotoAndStop("E3");
  235.             }
  236.             else
  237.             {
  238.                myMc.mc.onRollOver = function(p:Object):void
  239.                {
  240.                   _engine.playNoise(new NoiseObject({"code":"B_" + GlobalesFunctions.gimme2digits(this.zone)}));
  241.                   _engine.showIB({
  242.                      "id":"IB_" + GlobalesFunctions.gimme2digits(this.zone),
  243.                      "x":this.stage.mouseX,
  244.                      "y":this.stage.mouseY - 30
  245.                   });
  246.                };
  247.                myMc.mc.onRollOut = function(p:Object):void
  248.                {
  249.                   _engine.stopNoise(new NoiseObject({"code":"B_" + GlobalesFunctions.gimme2digits(this.zone)}));
  250.                   _engine.hideIB();
  251.                };
  252.                myMc.mc.onPress = function(p:Object):void
  253.                {
  254.                   _engine.hideIB();
  255.                   _timeline_.GotoAndStop("_" + GlobalesFunctions.gimme2digits(this.zone) + "_01");
  256.                   _engine.playComment(new CommentObject({
  257.                      "code":GlobalesFunctions.gimme2digits(this.zone) + "_01",
  258.                      "callback":testFin03
  259.                   }));
  260.                   doneZones[this.zone - 1] = 1;
  261.                };
  262.                myMc.activeMC();
  263.             }
  264.          }
  265.       }
  266.       
  267.       private function testFin03() : void
  268.       {
  269.          if(this.doneZones.indexOf(0) != -1)
  270.          {
  271.             this._timeline_.GotoAndPlayUntil({"labelStop":"ATTENTE_03"});
  272.          }
  273.          else
  274.          {
  275.             this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_zanim19"});
  276.          }
  277.       }
  278.       
  279.       private function initJeu01() : void
  280.       {
  281.          var myMc:InteractiveMovie = null;
  282.          this._engine.playComment(new CommentObject({
  283.             "code":"JEU01_01",
  284.             "callback":this._timeline_.nextLabel
  285.          }));
  286.          this.animMc = this.mainTimeline.ANIM;
  287.          this.animTl = new Timeline(this.animMc,this._timelineManager);
  288.          this.animTl.GotoAndPlayUntilTheEnd(1);
  289.          this.chandaMc = new InteractiveMovie(this.mainTimeline.CHANDRA,this._timelineManager);
  290.          this.chandaMc.gotoAndStop(1);
  291.          this.chandaMc.mc.mcI = this.chandaMc;
  292.          this.vigOrder = GlobalesFunctions.randomArray([1,2,3,4,5,6]);
  293.          trace("vigOrder",this.vigOrder);
  294.          for(var i:int = 1; i <= 6; i++)
  295.          {
  296.             myMc = new InteractiveMovie(this.mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  297.             myMc.gotoAndStop(this.vigOrder[i - 1]);
  298.             myMc.mc.vig = i;
  299.             this.animMc = myMc.mc.VIG;
  300.             this.animTl = new Timeline(this.animMc,this._timelineManager);
  301.             this.animTl.GotoAndStop(1);
  302.          }
  303.       }
  304.       
  305.       public function label_JEU01_03() : void
  306.       {
  307.          this.chandaMc.gotoAndPlayUntil({
  308.             "labelPlay":"E2",
  309.             "beforeLabelStop":"E3"
  310.          });
  311.       }
  312.       
  313.       private function attente04() : void
  314.       {
  315.          var myMc:InteractiveMovie = null;
  316.          this.chandaMc.gotoAndStop("E1");
  317.          this.chandaMc.mc.onRollOver = function(p:Object):void
  318.          {
  319.             _engine.playNoise(new NoiseObject({"code":"B_CHANDA"}));
  320.             this.mcI.gotoAndPlayUntil({
  321.                "labelPlay":"E2",
  322.                "beforeLabelStop":"E3"
  323.             });
  324.          };
  325.          this.chandaMc.mc.onRollOut = function(p:Object):void
  326.          {
  327.             _engine.stopNoise(new NoiseObject({"code":"B_CHANDA"}));
  328.          };
  329.          this.chandaMc.mc.onPress = function(p:Object):void
  330.          {
  331.             this.mcI.gotoAndStop("E3");
  332.             _engine.playComment(new CommentObject({
  333.                "code":"JEU01_AIDE",
  334.                "callback":stopChanda
  335.             }));
  336.             this.enabled = false;
  337.          };
  338.          this.chandaMc.activeMC();
  339.          myMc = new InteractiveMovie(this.mainTimeline["BT_OK"],this._timelineManager);
  340.          myMc.gotoAndStop(1);
  341.          myMc.mc.mcI = myMc;
  342.          myMc.mc.onRollOver = function(p:Object):void
  343.          {
  344.             _engine.playNoise(new NoiseObject({"code":"B_OK"}));
  345.             this.mcI.gotoAndPlayUntilTheEnd("E2");
  346.          };
  347.          myMc.mc.onRollOut = function(p:Object):void
  348.          {
  349.             _engine.stopNoise(new NoiseObject({"code":"B_OK"}));
  350.          };
  351.          myMc.mc.onPress = function(p:Object):void
  352.          {
  353.             var i:int = 0;
  354.             trace(vigOrder);
  355.             if(vigOrder.toString() == "1,2,3,4,5,6")
  356.             {
  357.                _engine.stopNoise(new NoiseObject({"code":"B_OK"}));
  358.                _engine.playNoise(new NoiseObject({"code":"B_GAGNE"}));
  359.                _timeline_.GotoAndPlayUntil({"labelStop":"WAIT_zanimGAGNE"});
  360.                animMc = mainTimeline.zanimGAGNE;
  361.                animTl = new Timeline(animMc,_timelineManager);
  362.                animTl.GotoAndPlayUntilTheEnd(1,initAnimGagne);
  363.                for(i = 1; i <= 6; i++)
  364.                {
  365.                   myMc = new InteractiveMovie(mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)],_timelineManager);
  366.                   myMc.mc.enabled = false;
  367.                   myMc.mc.buttonMode = false;
  368.                }
  369.                so.data.etatJeux[0] = 1;
  370.                so.flush();
  371.             }
  372.             else
  373.             {
  374.                _engine.stopNoise(new NoiseObject({"code":"B_OK"}));
  375.                _engine.playNoise(new NoiseObject({"code":"B_PERDU"}));
  376.             }
  377.          };
  378.          myMc.activeMC();
  379.          this.BT_OK = myMc;
  380.          this.listeRolledVIG = [];
  381.          for(var i:int = 1; i <= 6; i++)
  382.          {
  383.             myMc = new InteractiveMovie(this.mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  384.             myMc.gotoAndStop(this.vigOrder[i - 1]);
  385.             myMc.mc.vig = i;
  386.             myMc.mc.mcI = myMc;
  387.             myMc.mc.onRollOver = function(p:Object):void
  388.             {
  389.                var VIG_tl:Timeline = null;
  390.                if(gDrag == null)
  391.                {
  392.                   if(this.rolled == null)
  393.                   {
  394.                      testeRolledVIG();
  395.                      this.rolled = 1;
  396.                      VIG_tl = new Timeline(this.VIG,_timelineManager);
  397.                      VIG_tl.GotoAndStop("E2");
  398.                      _engine.playNoise(new NoiseObject({"code":"B_ROLL"}));
  399.                   }
  400.                }
  401.             };
  402.             myMc.mc.onRollOut = function(p:Object):void
  403.             {
  404.                var VIG_tl:Timeline = null;
  405.                if(gDrag == null)
  406.                {
  407.                   this.rolled = null;
  408.                   testeRolledVIG();
  409.                   VIG_tl = new Timeline(this.VIG,_timelineManager);
  410.                   VIG_tl.GotoAndStop("E1");
  411.                   _engine.stopNoise(new NoiseObject({"code":"B_ROLL"}));
  412.                }
  413.             };
  414.             myMc.mc.onMouseDown = function(p:Object):void
  415.             {
  416.                var VIG_tl:Timeline = null;
  417.                if(gDrag == null)
  418.                {
  419.                   if(_engine.pad !== null)
  420.                   {
  421.                      _engine.pad.activated = false;
  422.                   }
  423.                   BT_OK.desactive();
  424.                   gDrag = this;
  425.                   this.pCible = undefined;
  426.                   VIG_tl = new Timeline(this.VIG,_timelineManager);
  427.                   VIG_tl.GotoAndStop("E1");
  428.                   _engine.playNoise(new NoiseObject({"code":"B_CLIC"}));
  429.                   this.diffX = this.stage.mouseX - this.x;
  430.                   this.diffY = this.stage.mouseY - this.y;
  431.                }
  432.             };
  433.             myMc.mc.onMouseUp = function(p:Object):void
  434.             {
  435.                var cibleMc:MovieClip = null;
  436.                var cibleImage:int = 0;
  437.                var dragImage:int = 0;
  438.                var VIG_tl:Timeline = null;
  439.                var cible_tl:Timeline = null;
  440.                var cibleVIG_tl:Timeline = null;
  441.                if(gDrag == this)
  442.                {
  443.                   if(_engine.pad !== null)
  444.                   {
  445.                      _engine.pad.activated = true;
  446.                   }
  447.                   this.returnOrigPoint();
  448.                   if(cibleFound == 0)
  449.                   {
  450.                      _engine.playNoise(new NoiseObject({"code":"B_NO"}));
  451.                   }
  452.                   else
  453.                   {
  454.                      cibleMc = mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(cibleFound)];
  455.                      cibleImage = cibleMc.currentFrame;
  456.                      dragImage = this.currentFrame;
  457.                      _engine.playNoise(new NoiseObject({"code":"B_DEPOT"}));
  458.                      this.mcI.gotoAndStop(cibleImage);
  459.                      VIG_tl = new Timeline(this.VIG,_timelineManager);
  460.                      VIG_tl.GotoAndStop("E1");
  461.                      cible_tl = new Timeline(cibleMc,_timelineManager);
  462.                      cible_tl.GotoAndStop(dragImage);
  463.                      cibleVIG_tl = new Timeline(cibleMc.VIG,_timelineManager);
  464.                      cibleVIG_tl.GotoAndStop("E1");
  465.                      vigOrder[cibleFound - 1] = dragImage;
  466.                      vigOrder[this.vig - 1] = cibleImage;
  467.                      cibleFound = 0;
  468.                      gLastVIG = this;
  469.                      trace("vigOrder",vigOrder);
  470.                   }
  471.                   gDrag = null;
  472.                   this.rolled = null;
  473.                   BT_OK.active();
  474.                }
  475.             };
  476.             myMc.mc.onEnterFrame = function(p:Object):void
  477.             {
  478.                var VIG_tl:Timeline = null;
  479.                var generalMc:MovieClip = null;
  480.                this.x = this.stage.mouseX - this.diffX;
  481.                this.y = this.stage.mouseY - this.diffY;
  482.                var tpoint:Point = new Point(this.stage.mouseX,this.stage.mouseY);
  483.                cibleFound = 0;
  484.                for(var i:int = 1; i <= 6; i++)
  485.                {
  486.                   if(this.vig !== i)
  487.                   {
  488.                      generalMc = mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)];
  489.                      if(generalMc.hitTestPoint(tpoint.x,tpoint.y,true))
  490.                      {
  491.                         cibleFound = i;
  492.                         break;
  493.                      }
  494.                   }
  495.                }
  496.                if(cibleFound !== 0)
  497.                {
  498.                   if(this.pCible == undefined)
  499.                   {
  500.                      this.pCible = generalMc;
  501.                      VIG_tl = new Timeline(this.VIG,_timelineManager);
  502.                      VIG_tl.GotoAndStop("E3");
  503.                   }
  504.                }
  505.                else if(this.pCible !== undefined)
  506.                {
  507.                   this.pCible = undefined;
  508.                   VIG_tl = new Timeline(this.VIG,_timelineManager);
  509.                   VIG_tl.GotoAndStop("E1");
  510.                }
  511.             };
  512.             myMc.activeDragAndDropMC();
  513.          }
  514.          myMc = new InteractiveMovie(this.mainTimeline["FOND"],this._timelineManager);
  515.          myMc.onRollOver = function(p:Object):void
  516.          {
  517.             testeRolledVIG();
  518.          };
  519.          myMc.activeMC();
  520.          myMc.mc.useHandCursor = false;
  521.          myMc.mc.buttonMode = false;
  522.       }
  523.       
  524.       private function testeRolledVIG() : void
  525.       {
  526.          var myMc:MovieClip = null;
  527.          for(var i:int = 1; i <= 6; i++)
  528.          {
  529.             myMc = this.mainTimeline["VIG_" + GlobalesFunctions.gimme2digits(i)];
  530.             if(myMc.rolled == 1)
  531.             {
  532.                myMc.onRollOut({});
  533.             }
  534.          }
  535.       }
  536.       
  537.       private function stopChanda() : void
  538.       {
  539.          this.chandaMc.mc.enabled = true;
  540.          this.chandaMc.gotoAndStop("E1");
  541.       }
  542.       
  543.       private function initAnimGagne() : void
  544.       {
  545.          var bt:BtSuite = new BtSuite(this._engine,this._timelineManager,this._timeline_);
  546.          this.animEtape = 0;
  547.          this._timeline_.GotoAndPlayUntil({"labelStop":"ANIM_GAGNE"});
  548.       }
  549.       
  550.       public function suiteAnimGagne() : void
  551.       {
  552.          var myMc:InteractiveMovie = null;
  553.          if(this.animEtape == 6)
  554.          {
  555.             this._engine.hideSwf({"code":"BT_SUITE"});
  556.             this._timeline_.GotoAndPlayUntil({"labelStop":"_21"});
  557.          }
  558.          else
  559.          {
  560.             this.animEtape += 1;
  561.             this._engine.playComment(new CommentObject({
  562.                "code":"J01_" + GlobalesFunctions.gimme2digits(this.animEtape),
  563.                "callback":this.suiteAnimGagne
  564.             }));
  565.             myMc = new InteractiveMovie(this.mainTimeline.VIG,this._timelineManager);
  566.             myMc.gotoAndStop(this.animEtape);
  567.             myMc = new InteractiveMovie(this.mainTimeline.VIG.VIG,this._timelineManager);
  568.             myMc.gotoAndStop("E2");
  569.             this.animMc = this.mainTimeline.VIG.VIG.ANIM;
  570.             this.animTl = new Timeline(this.animMc,this._timelineManager);
  571.             this.animTl.GotoAndPlayUntilTheEnd(1);
  572.          }
  573.       }
  574.       
  575.       private function adapteVIG() : void
  576.       {
  577.          this.gLastVIG.height = 600;
  578.          this.gLastVIG.width = 800;
  579.       }
  580.       
  581.       public function label_JEU02_01() : void
  582.       {
  583.          var i:int = 0;
  584.          var myMc:InteractiveMovie = null;
  585.          for(i = 1; i <= 3; i++)
  586.          {
  587.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  588.             myMc.gotoAndStop(1);
  589.          }
  590.          for(i = 1; i <= 3; i++)
  591.          {
  592.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["GARDE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  593.             myMc.gotoAndStop(1);
  594.          }
  595.          for(i = 1; i <= 8; i++)
  596.          {
  597.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["C" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  598.             myMc.gotoAndStop(1);
  599.          }
  600.          for(i = 1; i <= 6; i++)
  601.          {
  602.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["D" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  603.             myMc.gotoAndStop(1);
  604.          }
  605.       }
  606.       
  607.       public function labelATTENTE_05() : void
  608.       {
  609.          var i:int = 0;
  610.          var myMc:InteractiveMovie = null;
  611.          this.countGardes = 0;
  612.          for(i = 1; i <= 3; i++)
  613.          {
  614.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  615.             myMc.gotoAndStop(1);
  616.             myMc.mc.zone = i;
  617.             myMc.mc.mcI = myMc;
  618.             myMc.mc.onRollOver = function(p:Object):void
  619.             {
  620.                this.mcI.gotoAndStop("E2");
  621.                animMc = this.ANIM;
  622.                animTl = new Timeline(animMc,_timelineManager);
  623.                animTl.GotoAndPlayUntilTheEnd(1);
  624.                _engine.playNoise(new NoiseObject({"code":"B_P_" + GlobalesFunctions.gimme2digits(this.zone)}));
  625.                _engine.showIB({
  626.                   "id":"IB_P_" + GlobalesFunctions.gimme2digits(this.zone),
  627.                   "x":this.stage.mouseX,
  628.                   "y":120
  629.                });
  630.             };
  631.             myMc.mc.onRollOut = function(p:Object):void
  632.             {
  633.                this.mcI.gotoAndStop("E1");
  634.                _engine.stopNoise(new NoiseObject({"code":"B_P_" + GlobalesFunctions.gimme2digits(this.zone)}));
  635.                _engine.hideIB();
  636.             };
  637.             myMc.mc.onPress = function(p:Object):void
  638.             {
  639.                this.mcI.gotoAndStop("E3");
  640.                portrait = this;
  641.                _engine.hideIB();
  642.                _engine.playComment(new CommentObject({
  643.                   "code":"JEU02_P" + GlobalesFunctions.gimme2digits(this.zone),
  644.                   "callback":stopPortrait
  645.                }));
  646.             };
  647.             myMc.activeMC();
  648.          }
  649.          for(i = 1; i <= 3; i++)
  650.          {
  651.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["GARDE_" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  652.             myMc.gotoAndStop(1);
  653.             myMc.mc.zone = i;
  654.             myMc.mc.mcI = myMc;
  655.             myMc.mc.onRollOver = function(p:Object):void
  656.             {
  657.                this.mcI.gotoAndStop("E1");
  658.             };
  659.             myMc.mc.onRollOut = function(p:Object):void
  660.             {
  661.                this.mcI.gotoAndStop("E1");
  662.             };
  663.             myMc.mc.onPress = function(p:Object):void
  664.             {
  665.                _engine.playNoise(new NoiseObject({"code":"B_GOOD"}));
  666.                this.mcI.gotoAndStop("E2");
  667.                animMc = this.ANIM;
  668.                animTl = new Timeline(animMc,_timelineManager);
  669.                animTl.GotoAndPlayUntilTheEnd(1,testGardes);
  670.                this.enabled = false;
  671.                this.buttonMode = false;
  672.                mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(this.zone)].gotoAndStop("E4");
  673.                mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(this.zone)].enabled = false;
  674.                mainTimeline.JEU_02["PORTRAIT_" + GlobalesFunctions.gimme2digits(this.zone)].buttonMode = false;
  675.             };
  676.             myMc.activeMC();
  677.          }
  678.          for(i = 1; i <= 8; i++)
  679.          {
  680.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["C" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  681.             myMc.gotoAndStop(1);
  682.             myMc.mc.zone = i;
  683.             myMc.mc.onPress = function(p:Object):void
  684.             {
  685.                _engine.playNoise(new NoiseObject({"code":"B_BAD"}));
  686.             };
  687.             myMc.activeMC();
  688.          }
  689.          for(i = 1; i <= 6; i++)
  690.          {
  691.             myMc = new InteractiveMovie(this.mainTimeline.JEU_02["D" + GlobalesFunctions.gimme2digits(i)],this._timelineManager);
  692.             myMc.gotoAndStop(1);
  693.             myMc.mc.zone = i;
  694.             myMc.mc.onPress = function(p:Object):void
  695.             {
  696.                _engine.playNoise(new NoiseObject({"code":"B_BAD"}));
  697.             };
  698.             myMc.activeMC();
  699.          }
  700.       }
  701.       
  702.       private function stopPortrait() : void
  703.       {
  704.          this.portrait.gotoAndStop("E1");
  705.       }
  706.       
  707.       private function testGardes() : void
  708.       {
  709.          this.countGardes += 1;
  710.          if(this.countGardes == 3)
  711.          {
  712.             this.so.data.ecranEnCours = 2;
  713.             this.so.flush();
  714.             this._timeline_.GotoAndPlayUntil({"labelStop":"WAIT_zanimGAGNE05"});
  715.          }
  716.       }
  717.       
  718.       public function endMODULE() : void
  719.       {
  720.          trace("fin du module");
  721.          this._engine.host.changeModule({"numMod":2});
  722.       }
  723.       
  724.       public function sleep() : void
  725.       {
  726.          this._pauseManager = new PauseManager(this._engine,this._timelineManager);
  727.          this._pauseManager.sleepMovie(this.mainTimeline);
  728.       }
  729.       
  730.       public function wake() : void
  731.       {
  732.          if(this._pauseManager != null)
  733.          {
  734.             this._pauseManager.wakeMovie(this.mainTimeline);
  735.          }
  736.       }
  737.       
  738.       public function destroy() : void
  739.       {
  740.          this._engine.stopAllSounds();
  741.          this._timeline_.kilListeners();
  742.       }
  743.    }
  744. }
  745.