home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 160 / MOBICLIC160.ISO / pc / DATA / INV160 / INV160_00 / INV160_00.swf / scripts / frame_1 / DoAction.as
Encoding:
Text File  |  2013-12-16  |  32.7 KB  |  1,318 lines

  1. function initKeyPause()
  2. {
  3.    gPauseOn = 0;
  4.    gPauseSpaceOn = 0;
  5.    gPauseSpaceEnCours = 0;
  6. }
  7. function initGen()
  8. {
  9.    this._lockroot = true;
  10.    gClipGen = this;
  11.    Stage.showMenu = false;
  12.    gLangue = "FR";
  13.    gMusicOn = 1;
  14.    gSousTitre = 0;
  15.    gST = 0;
  16.    gVolume = 100;
  17.    gWidth = moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.width;
  18.    gHeight = moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.height;
  19.    if(gWidth == undefined)
  20.    {
  21.       gWidth = 800;
  22.    }
  23.    else
  24.    {
  25.       gWidth = Number(gWidth);
  26.    }
  27.    if(gHeight == undefined)
  28.    {
  29.       gHeight = 600;
  30.    }
  31.    else
  32.    {
  33.       gHeight = Number(gHeight);
  34.    }
  35.    initKeyPause();
  36. }
  37. function testeDebutCommentSpecial()
  38. {
  39.    switch(gCommentOn.id.split("_")[gCommentOn.id.split("_").length - 1])
  40.    {
  41.       case "bz":
  42.       case "BZ":
  43.          trace("-------  BZ on-----------");
  44.          startMascotte();
  45.          break;
  46.       case "ze":
  47.       case "ZE":
  48.          trace("-------  ZE on-----------");
  49.          DesactiveOEIL();
  50.          if(BT_OEIL.gEtat !== 3)
  51.          {
  52.             BT_OEIL.gotoAndPlay("E3");
  53.          }
  54.          else
  55.          {
  56.             BT_OEIL.OEIL_P.gotoAndPlay("parle");
  57.          }
  58.          afficherRolls();
  59.          break;
  60.       case "sp":
  61.       case "SP":
  62.          trace("-------  SP on-----------");
  63.          MASCOTTE_SPAM.gotoAndStop("E1");
  64.          MASCOTTE_SPAM._visible = true;
  65.          break;
  66.       case "wk":
  67.       case "WK":
  68.          trace("-------  WK on-----------");
  69.          trace("-------  MASCOTTE_WIKI-----------");
  70.          MASCOTTE_WIKI.gotoAndStop("E1");
  71.          MASCOTTE_WIKI._visible = true;
  72.          break;
  73.       case "bg":
  74.       case "BG":
  75.          trace("-------  BG on-----------");
  76.          MASCOTTE_BUG.gotoAndStop("E1");
  77.          MASCOTTE_BUG._visible = true;
  78.          break;
  79.       case "lz":
  80.       case "LZ":
  81.          trace("-------  LZ on-----------");
  82.          MASCOTTE_LIZ.gotoAndStop("E1");
  83.          MASCOTTE_LIZ._visible = true;
  84.          break;
  85.       case "tt":
  86.       case "TT":
  87.          trace("-------  TT on-----------");
  88.          MASCOTTE_TOT.gotoAndStop("E1");
  89.          MASCOTTE_TOT._visible = true;
  90.    }
  91. }
  92. function testeFinCommentSpecial()
  93. {
  94.    switch(gCommentOn.id.split("_")[gCommentOn.id.split("_").length - 1])
  95.    {
  96.       case "bz":
  97.       case "BZ":
  98.          trace("-------  BZ off-----------");
  99.          stopMascotte();
  100.          break;
  101.       case "ze":
  102.       case "ZE":
  103.          trace("-------  ZE off-----------");
  104.          ActiveOEIL();
  105.          BT_OEIL.OEIL_P.gotoAndPlay("rentre");
  106.          BT_OEIL.gClicOn = undefined;
  107.          masquerRolls();
  108.          break;
  109.       case "sp":
  110.       case "SP":
  111.          trace("-------  SP off-----------");
  112.          MASCOTTE_SPAM.gotoAndStop("E2");
  113.          if(MASCOTTE_SPAM.CacherApres != false)
  114.          {
  115.             MASCOTTE_SPAM._visible = false;
  116.          }
  117.          break;
  118.       case "wk":
  119.       case "WK":
  120.          trace("-------  WK off-----------");
  121.          MASCOTTE_WIKI.gotoAndStop("E2");
  122.          if(MASCOTTE_WIKI.CacherApres != false)
  123.          {
  124.             MASCOTTE_WIKI._visible = false;
  125.          }
  126.          break;
  127.       case "bg":
  128.       case "BG":
  129.          trace("-------  BG off-----------");
  130.          MASCOTTE_BUG.gotoAndStop("E2");
  131.          if(MASCOTTE_BUG.CacherApres != false)
  132.          {
  133.             MASCOTTE_BUG._visible = false;
  134.          }
  135.          break;
  136.       case "lz":
  137.       case "LZ":
  138.          trace("-------  LZ off-----------");
  139.          MASCOTTE_LIZ.gotoAndStop("E2");
  140.          if(MASCOTTE_LIZ.CacherApres != false)
  141.          {
  142.             MASCOTTE_LIZ._visible = false;
  143.          }
  144.          break;
  145.       case "tt":
  146.       case "TT":
  147.          trace("-------  TT off-----------");
  148.          MASCOTTE_TOT.gotoAndStop("E2");
  149.          if(MASCOTTE_TOT.CacherApres != false)
  150.          {
  151.             MASCOTTE_TOT._visible = false;
  152.          }
  153.    }
  154. }
  155. function stopComment()
  156. {
  157.    if(gCommentOn !== undefined)
  158.    {
  159.       testeFinCommentSpecial();
  160.       delete gCommentOn.onSoundComplete;
  161.       gCommentOn.stop();
  162.       gCommentOn = undefined;
  163.       if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  164.       {
  165.          soundObjects[gMusic].setVolume(gVolume);
  166.       }
  167.       if(gPauseOn == undefined || gPauseOn == 0)
  168.       {
  169.          removeMovieClip("mcClicZap");
  170.       }
  171.       gBlockST = undefined;
  172.       gereTextes.masqueST();
  173.       if(gClipTarget !== undefined)
  174.       {
  175.          gClipTarget.gotoAndStop(gClipTargetLabel);
  176.          gClipTarget = undefined;
  177.          gClipTargetLabel = undefined;
  178.       }
  179.    }
  180. }
  181. function pauseComment()
  182. {
  183.    trace("pauseComment " + gCommentOn);
  184.    if(gCommentOn !== undefined)
  185.    {
  186.       gCommentOn.stop();
  187.       mcClicZap._visible = false;
  188.    }
  189. }
  190. function continueComment()
  191. {
  192.    trace("continueComment " + gCommentOn);
  193.    if(gCommentOn !== undefined)
  194.    {
  195.       gCommentOn.start(gCommentOn.position / 1000);
  196.       mcClicZap._visible = true;
  197.    }
  198. }
  199. function joueSon(p)
  200. {
  201.    var _loc4_ = p.nomSon;
  202.    gSoundString = _loc4_;
  203.    if(p.mc !== undefined)
  204.    {
  205.       gClipRef = p.mc;
  206.    }
  207.    else
  208.    {
  209.       gClipRef = _root;
  210.    }
  211.    if(p.zapBlock !== undefined)
  212.    {
  213.       gClicZap = p.zapBlock;
  214.    }
  215.    else
  216.    {
  217.       gClicZap = "ZAP_BLOCK";
  218.    }
  219.    if(p.actionFin !== undefined)
  220.    {
  221.       gActionFinSon = p.actionFin;
  222.    }
  223.    else
  224.    {
  225.       gActionFinSon = "PLAY";
  226.    }
  227.    stopComment();
  228.    if(p.mcCible !== undefined)
  229.    {
  230.       if(typeof p.mcCible == "movieclip")
  231.       {
  232.          gClipTarget = p.mcCible;
  233.       }
  234.       else
  235.       {
  236.          gClipTarget = gClipRef[p.mcCible];
  237.       }
  238.       if(p.mcLabelOut !== undefined)
  239.       {
  240.          gClipTargetLabel = p.mcLabelOut;
  241.       }
  242.       else
  243.       {
  244.          gClipTargetLabel = gClipTarget._currentframe;
  245.       }
  246.       if(p.mcLabelIn !== undefined)
  247.       {
  248.          gClipTarget.gotoAndPlay(p.mcLabelIn);
  249.       }
  250.       else
  251.       {
  252.          gClipTarget.gotoAndPlay("parle");
  253.       }
  254.    }
  255.    gCommentName = "S_" + gLangue + "_" + gModuleName + "_";
  256.    trace("joueSon " + gCommentName + _loc4_);
  257.    mySound = soundObjects[gCommentName + _loc4_];
  258.    if(mySound !== undefined)
  259.    {
  260.       gCommentOn = mySound;
  261.       gCommentOn.p = p;
  262.       gCommentOn.id = gCommentName + _loc4_;
  263.       testeDebutCommentSpecial();
  264.       if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  265.       {
  266.          soundObjects[gMusic].setVolume(gVolume * 40 / 100);
  267.       }
  268.       mySound.setVolume(gVolume);
  269.       if(gCommentOnPausePos !== undefined)
  270.       {
  271.          mySound.start(gCommentOnPausePos / 1000);
  272.          gCommentOnPause = undefined;
  273.          gCommentOnPausePos = undefined;
  274.       }
  275.       else
  276.       {
  277.          mySound.start();
  278.       }
  279.    }
  280.    else
  281.    {
  282.       trace("______" + getSoundByID(gCommentName + _loc4_) + gCommentName);
  283.       var _loc5_ = getSoundByID(gCommentName + _loc4_);
  284.       if(_loc5_ !== undefined)
  285.       {
  286.          mySound = new Sound();
  287.          mySound.onLoad = function(success)
  288.          {
  289.             if(success)
  290.             {
  291.                if(gCommentOnPausePos !== undefined)
  292.                {
  293.                   mySound.start(gCommentOnPausePos / 1000);
  294.                   gCommentOnPause = undefined;
  295.                   gCommentOnPausePos = undefined;
  296.                }
  297.                else
  298.                {
  299.                   mySound.start();
  300.                }
  301.             }
  302.          };
  303.          mySound.loadSound(this.gModulePath + _loc5_.attributes.src,true);
  304.          gCommentOn = mySound;
  305.          gCommentOn.p = p;
  306.          gCommentOn.id = gCommentName + _loc4_;
  307.          testeDebutCommentSpecial();
  308.          if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  309.          {
  310.             soundObjects[gMusic].setVolume(gVolume * 40 / 100);
  311.          }
  312.       }
  313.    }
  314.    if(mySound == undefined)
  315.    {
  316.       return undefined;
  317.    }
  318.    mySound.onSoundComplete = commentFini;
  319.    if(gClicZap !== "NOZAP_NOBLOCK")
  320.    {
  321.       mcClicZap = creerRectangle({nom:"mcClicZap",pere:_root,level:15000,width:gWidth,height:gHeight,x:0,y:0,alpha:0});
  322.       switch(gClicZap.split("_")[0])
  323.       {
  324.          case "ZAP":
  325.             mcClicZap.useHandCursor = false;
  326.             mcClicZap.onPress = function()
  327.             {
  328.                if(gCommentOn.position !== gCommentOn.duration)
  329.                {
  330.                   trace("clic zap son");
  331.                   stopSon();
  332.                }
  333.             };
  334.             break;
  335.          case "NOZAP":
  336.             mcClicZap.useHandCursor = false;
  337.             mcClicZap.onPress = function()
  338.             {
  339.                trace("no clic allowed");
  340.             };
  341.       }
  342.       mcClicZap._visible = true;
  343.    }
  344.    if(gST == 1 && gBlockST == undefined)
  345.    {
  346.       gereTextes.afficheST(gCommentName + _loc4_);
  347.    }
  348. }
  349. function creerClicZap(p)
  350. {
  351.    if(_global.mcClicZap2 != undefined)
  352.    {
  353.       removeMovieClip(_root.mcClicZap2);
  354.    }
  355.    var _loc0_ = null;
  356.    var _loc4_ = _global.mcClicZap2 = creerRectangle({nom:"mcClicZap2",pere:_root,level:15001,width:gWidth,height:gHeight,x:0,y:0,alpha:0});
  357.    _loc4_.p = p;
  358.    _loc4_.useHandCursor = false;
  359.    _loc4_.onPress = function()
  360.    {
  361.       trace("clic zap " + this.p);
  362.       this.p.retour.call(this.p.ecouteur);
  363.       removeMovieClip(this);
  364.       _global.mcClicZap2 = undefined;
  365.    };
  366.    _loc4_._visible = true;
  367. }
  368. function creerRectangle(p)
  369. {
  370.    var _loc15_ = p.x != undefined ? p.x : 0;
  371.    var _loc13_ = p.y != undefined ? p.y : 0;
  372.    if(p.w != undefined)
  373.    {
  374.       var _loc16_ = p.w;
  375.    }
  376.    else if(p.width != undefined)
  377.    {
  378.       _loc16_ = p.width;
  379.    }
  380.    if(p.h != undefined)
  381.    {
  382.       var _loc14_ = p.h;
  383.    }
  384.    else if(p.height != undefined)
  385.    {
  386.       _loc14_ = p.height;
  387.    }
  388.    var _loc11_ = p.pere != undefined ? p.pere : _root;
  389.    var _loc9_ = p.level != undefined ? p.level : 10;
  390.    var _loc12_ = p.couleur != undefined ? p.couleur : 0;
  391.    var _loc10_ = p.nom != undefined ? p.nom : "ClipSansNom";
  392.    var _loc4_ = p.courbure != undefined ? p.courbure : 0;
  393.    var _loc17_ = p.alpha != undefined ? p.alpha : 100;
  394.    var _loc6_ = 0;
  395.    var _loc7_ = 0;
  396.    var _loc8_ = _loc16_;
  397.    var _loc5_ = _loc14_;
  398.    var _loc3_ = _loc11_.createEmptyMovieClip(_loc10_,_loc9_);
  399.    _loc3_.beginFill(_loc12_,_loc17_);
  400.    _loc3_.moveTo(_loc6_,_loc5_ - _loc4_);
  401.    _loc3_.lineTo(_loc6_,_loc7_ + _loc4_);
  402.    _loc3_.curveTo(_loc6_,_loc7_,_loc6_ + _loc4_,_loc7_);
  403.    _loc3_.lineTo(_loc8_ - _loc4_,_loc7_);
  404.    _loc3_.curveTo(_loc8_,_loc7_,_loc8_,_loc7_ + _loc4_);
  405.    _loc3_.lineTo(_loc8_,_loc5_ - _loc4_);
  406.    _loc3_.curveTo(_loc8_,_loc5_,_loc8_ - _loc4_,_loc5_);
  407.    _loc3_.lineTo(_loc6_ + _loc4_,_loc5_);
  408.    _loc3_.curveTo(_loc6_,_loc5_,_loc6_,_loc5_ - _loc4_);
  409.    _loc3_.endFill();
  410.    _loc3_._x = _loc15_;
  411.    _loc3_._y = _loc13_;
  412.    return _loc3_;
  413. }
  414. function stopSon()
  415. {
  416.    gCommentOn.stop();
  417.    commentFini();
  418. }
  419. function commentFini()
  420. {
  421.    testeFinCommentSpecial();
  422.    gCommentOn = undefined;
  423.    if(gClicZap !== "NOZAP_NOBLOCK")
  424.    {
  425.       removeMovieClip("mcClicZap");
  426.    }
  427.    gBlockST = undefined;
  428.    gereTextes.masqueST();
  429.    if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  430.    {
  431.       soundObjects[gMusic].setVolume(gVolume);
  432.    }
  433.    if(gClipTarget !== undefined)
  434.    {
  435.       gClipTarget.gotoAndStop(gClipTargetLabel);
  436.       gClipTarget = undefined;
  437.       gClipTargetLabel = undefined;
  438.    }
  439.    switch(gActionFinSon)
  440.    {
  441.       case "RIEN":
  442.          break;
  443.       case "PLAY":
  444.          if(_root.gNextLabel == undefined)
  445.          {
  446.             if(gLineaireOn !== undefined)
  447.             {
  448.                var _loc0_ = null;
  449.                if((_loc0_ = gLineaireOn) !== "_")
  450.                {
  451.                   lSonSuivant = gLineaireOn + gimme2digits(Number(gSoundString.split("_")[gSoundString.split("_").length - 1]) + 1);
  452.                   lLabel = lSonSuivant;
  453.                }
  454.                else
  455.                {
  456.                   lSonSuivant = gimme2digits(Number(gSoundString.split("_")[gSoundString.split("_").length - 1]) + 1);
  457.                   lLabel = gLineaireOn + lSonSuivant;
  458.                }
  459.                gClipRef.gotoAndStop(lLabel);
  460.                joueSon({mc:gClipRef,nomSon:lSonSuivant,zapBlock:gClicZap,actionFin:gActionFinSon});
  461.             }
  462.             else
  463.             {
  464.                gClipRef.play();
  465.             }
  466.          }
  467.          else
  468.          {
  469.             gClipRef.gotoAndPlay(_root.gNextLabel);
  470.             _root.gNextLabel = undefined;
  471.             gLineaireOn = undefined;
  472.          }
  473.          break;
  474.       default:
  475.          gClipRef[gActionFinSon]();
  476.    }
  477. }
  478. function getSimilarSound(nom_son)
  479. {
  480.    if(getSoundByID("S_" + gLangue + "_" + gModuleName + "_" + nom_son + "_WK") != undefined)
  481.    {
  482.       return nom_son + "_WK";
  483.    }
  484.    if(getSoundByID("S_" + gLangue + "_" + gModuleName + "_" + nom_son + "_BG") != undefined)
  485.    {
  486.       return nom_son + "_BG";
  487.    }
  488.    if(getSoundByID("S_" + gLangue + "_" + gModuleName + "_" + nom_son + "_SP") != undefined)
  489.    {
  490.       return nom_son + "_SP";
  491.    }
  492.    if(getSoundByID("S_" + gLangue + "_" + gModuleName + "_" + nom_son + "_LZ") != undefined)
  493.    {
  494.       return nom_son + "_LZ";
  495.    }
  496.    if(getSoundByID("S_" + gLangue + "_" + gModuleName + "_" + nom_son + "_TT") != undefined)
  497.    {
  498.       return nom_son + "_TT";
  499.    }
  500. }
  501. function joueBruitage(p)
  502. {
  503.    var _loc2_ = soundObjects[gBruitageName + p.nomSon];
  504.    trace("joueBruitage : " + p.nomSon + " : " + _loc2_ + " A " + p.actionFin);
  505.    if(gListeBruitage == undefined)
  506.    {
  507.       gListeBruitage = [];
  508.       gListeA_fin_Bruitage = [];
  509.       gListeLoop_Bruitage = [];
  510.    }
  511.    _loc2_.setVolume(gVolume);
  512.    _loc2_.id = p.nomSon;
  513.    gListeBruitage.push(_loc2_.id);
  514.    if(p.actionFin !== undefined)
  515.    {
  516.       gActionFinBruitage = p.actionFin;
  517.       gListeA_fin_Bruitage.push(gActionFinBruitage);
  518.    }
  519.    else
  520.    {
  521.       gActionFinBruitage = undefined;
  522.       gListeA_fin_Bruitage.push("");
  523.    }
  524.    _loc2_.p = p;
  525.    _loc2_.onSoundComplete = mx.utils.Delegate.create(_loc2_,finBruitage);
  526.    if(p.loopSon == undefined)
  527.    {
  528.       _loc2_.start(p.offset);
  529.       gListeLoop_Bruitage.push("");
  530.    }
  531.    else
  532.    {
  533.       _loc2_.start(p.offset,p.loopSon);
  534.       gListeLoop_Bruitage.push(p.loopSon);
  535.    }
  536.    if(_loc2_ == undefined)
  537.    {
  538.       trace("joueBruitage : " + p.nomSon + " : " + _loc2_);
  539.    }
  540. }
  541. function stopBruitage(p)
  542. {
  543.    var _loc1_ = soundObjects[gBruitageName + p.nomSon];
  544.    finBruitage(p.nomSon);
  545.    _loc1_.stop();
  546. }
  547. function finBruitage(lSon)
  548. {
  549.    if(lSon == undefined)
  550.    {
  551.       lSon = this.id;
  552.    }
  553.    if(gListeBruitage !== undefined)
  554.    {
  555.       var _loc2_ = getPos(gListeBruitage,lSon);
  556.       if(_loc2_ !== -1)
  557.       {
  558.          if(gListeA_fin_Bruitage[_loc2_] !== "")
  559.          {
  560.             if(typeof gListeA_fin_Bruitage[_loc2_] == "string")
  561.             {
  562.                gClipGen[gListeA_fin_Bruitage[_loc2_]]();
  563.             }
  564.             else
  565.             {
  566.                gListeA_fin_Bruitage[_loc2_].call(this.p.MC);
  567.             }
  568.          }
  569.          gListeA_fin_Bruitage.splice(_loc2_,1);
  570.          gListeLoop_Bruitage.splice(_loc2_,1);
  571.          gListeBruitage.splice(_loc2_,1);
  572.          if(gListeBruitage.length == 0)
  573.          {
  574.             gListeBruitage = undefined;
  575.             gListeA_fin_Bruitage = undefined;
  576.             gListeLoop_Bruitage = undefined;
  577.          }
  578.       }
  579.    }
  580. }
  581. function stopBruit(p)
  582. {
  583.    if(gListeBruitage !== undefined)
  584.    {
  585.       if(getPos(gListeBruitage,p.nomSon) !== -1)
  586.       {
  587.          var _loc1_ = soundObjects[gBruitageName + p.nomSon];
  588.          delete _loc1_.onSoundComplete;
  589.          lSon = p.nomSon;
  590.          gListeA_fin_Bruitage.splice(getPos(gListeBruitage,lSon),1);
  591.          gListeLoop_Bruitage.splice(getPos(gListeBruitage,lSon),1);
  592.          gListeBruitage.splice(getPos(gListeBruitage,lSon),1);
  593.          if(gListeBruitage.length == 0)
  594.          {
  595.             gListeBruitage = undefined;
  596.             gListeA_fin_Bruitage = undefined;
  597.             gListeLoop_Bruitage = undefined;
  598.          }
  599.          _loc1_.stop();
  600.       }
  601.    }
  602. }
  603. function stopAllBruitages(lFinBruitage)
  604. {
  605.    if(gListeBruitage !== undefined)
  606.    {
  607.       var _loc3_ = gListeBruitage.length;
  608.       var _loc1_ = _loc3_ - 1;
  609.       while(_loc1_ >= 0)
  610.       {
  611.          if(lFinBruitage == 1)
  612.          {
  613.             stopBruitage({nomSon:gListeBruitage[_loc1_]});
  614.          }
  615.          else
  616.          {
  617.             stopBruit({nomSon:gListeBruitage[_loc1_]});
  618.          }
  619.          _loc1_ = _loc1_ - 1;
  620.       }
  621.    }
  622. }
  623. function getPos(myList, myValue)
  624. {
  625.    lPresent = -1;
  626.    maPosition = 0;
  627.    while(maPosition < myList.length)
  628.    {
  629.       if(myList[maPosition] == myValue)
  630.       {
  631.          lPresent = maPosition;
  632.          break;
  633.       }
  634.       maPosition++;
  635.    }
  636.    return lPresent;
  637. }
  638. function trouvePosMax(myList)
  639. {
  640.    lMax = myList[0];
  641.    lPosMax = 0;
  642.    i = 1;
  643.    while(i < myList.length)
  644.    {
  645.       if(myList[i] > lMax)
  646.       {
  647.          lMax = myList[i];
  648.          lPosMax = i;
  649.       }
  650.       i++;
  651.    }
  652.    return lPosMax;
  653. }
  654. function duplicate(myList)
  655. {
  656.    newList = [];
  657.    i = 0;
  658.    while(i <= myList.length - 1)
  659.    {
  660.       newList.push(myList[i]);
  661.       i++;
  662.    }
  663.    return newList;
  664. }
  665. function randomiseList(myList)
  666. {
  667.    var _loc3_ = duplicate(myList);
  668.    trace("lList = " + _loc3_);
  669.    var _loc4_ = [];
  670.    var _loc5_ = _loc3_.length;
  671.    var _loc2_ = 0;
  672.    while(_loc2_ < _loc5_)
  673.    {
  674.       var _loc1_ = randomValue(0,_loc3_.length - 1);
  675.       _loc4_.push(_loc3_[_loc1_]);
  676.       _loc3_.splice(_loc1_,1);
  677.       _loc2_ = _loc2_ + 1;
  678.    }
  679.    return _loc4_;
  680. }
  681. function returnNodeByPathRandomise(nodeSent)
  682. {
  683.    var _loc4_ = new XML();
  684.    var _loc5_ = nodeSent.childNodes.length;
  685.    var _loc1_ = 0;
  686.    while(_loc1_ < _loc5_)
  687.    {
  688.       var _loc2_ = randomValue(0,nodeSent.childNodes.length - 1);
  689.       _loc4_.appendChild(nodeSent.childNodes[_loc2_]);
  690.       _loc1_ = _loc1_ + 1;
  691.    }
  692.    return _loc4_;
  693. }
  694. function zapIntro(myLabel)
  695. {
  696.    mcClicZapIntro = this.createEmptyMovieClip("mcClicZapIntro",16031);
  697.    mcClicZapIntro.attachMovie("ClipInvisible","ClipInvisible",2);
  698.    mcClicZapIntro._width = gClipGen._width;
  699.    mcClicZapIntro._height = gClipGen._height;
  700.    mcClicZapIntro._x = 0;
  701.    mcClicZapIntro._y = 0;
  702.    mcClicZapIntro.useHandCursor = false;
  703.    mcClicZapIntro.onPress = function()
  704.    {
  705.       trace("clic zappIntro " + this);
  706.       stopComment();
  707.       gotoAndPlay(myLabel);
  708.       removeZapIntro();
  709.    };
  710. }
  711. function removeZapIntro()
  712. {
  713.    trace("mcClicZapIntrO " + mcClicZapIntro._name + " " + this);
  714.    if(mcClicZapIntro._x != undefined)
  715.    {
  716.       trace("suppression");
  717.       removeMovieClip(mcClicZapIntro);
  718.    }
  719. }
  720. function onMcOut(myMc)
  721. {
  722.    gereCursor(1);
  723.    if(myMc.pLabelOut == undefined)
  724.    {
  725.       myMc.gotoAndPlay("E1");
  726.    }
  727.    else
  728.    {
  729.       myMc.gotoAndPlay(myMc.pLabelOut);
  730.    }
  731.    if(myMc.pSon.split("")[0] == "B")
  732.    {
  733.       stopBruitage({nomSon:myMc.pSon});
  734.    }
  735.    else
  736.    {
  737.       stopComment();
  738.    }
  739.    if(myMc.pIB !== undefined)
  740.    {
  741.       gereTextes.masqueIB();
  742.    }
  743. }
  744. function onMcOver(p)
  745. {
  746.    var myMc = p.mc;
  747.    myMc.pIB = p.codeIB;
  748.    if(p.nomSon == undefined)
  749.    {
  750.       if(p.nomSonC == undefined)
  751.       {
  752.          myMc.pSon = "B_" + myMc._name.split("_")[1];
  753.       }
  754.       else
  755.       {
  756.          myMc.pSon = p.nomSonC;
  757.       }
  758.    }
  759.    else
  760.    {
  761.       myMc.pSon = p.nomSon;
  762.    }
  763.    if(p.actionFin == undefined)
  764.    {
  765.       myMc.actionFin = "RIEN";
  766.    }
  767.    else
  768.    {
  769.       myMc.actionFin = p.actionFin;
  770.    }
  771.    myMc.pLabelOut = p.mcLabelOut;
  772.    myMc.onRollOver = function()
  773.    {
  774.       gereCursor(2);
  775.       if(p.mcLabelIn == undefined)
  776.       {
  777.          this.gotoAndPlay("E2");
  778.       }
  779.       else
  780.       {
  781.          this.gotoAndPlay(p.mcLabelIn);
  782.       }
  783.       if(this.pSon.split("")[0] == "B")
  784.       {
  785.          joueBruitage({nomSon:this.pSon});
  786.       }
  787.       else
  788.       {
  789.          joueSon({nomSon:this.pSon,zapBlock:"NOZAP_NOBLOCK",actionFin:this.actionFin});
  790.       }
  791.       if(this.pIB !== undefined)
  792.       {
  793.          gereTextes.afficheIB({mc:this,codeIB:this.pIB});
  794.       }
  795.    };
  796.    myMc.onRollOut = myMc.onDragOut = function()
  797.    {
  798.       onMcOut(myMc);
  799.    };
  800. }
  801. function desactiveClip(pClip)
  802. {
  803.    delete pClip.onRollOver;
  804.    delete pClip.onRollOut;
  805.    delete pClip.onDragOut;
  806.    delete pClip.onPress;
  807.    delete pClip.onRelease;
  808.    delete pClip.onReleaseOutside;
  809. }
  810. function afficheClipPos(myMc, myX, myY)
  811. {
  812.    myMc._x = myX;
  813.    myMc._y = myY;
  814.    myMc._visible = true;
  815. }
  816. function gimme2digits(X)
  817. {
  818.    if(Number(X) < 10)
  819.    {
  820.       lX = "0" + Number(X);
  821.    }
  822.    else
  823.    {
  824.       lX = String(X);
  825.    }
  826.    return lX;
  827. }
  828. function randomValue(min, max)
  829. {
  830.    var _loc1_ = Math.floor(Math.random() * (max - min + 1)) + min;
  831.    return _loc1_;
  832. }
  833. function chercheDepthPlus(myMc, myDepth)
  834. {
  835.    var _loc1_ = myDepth;
  836.    while(_loc1_ < 17000)
  837.    {
  838.       if(myMc.getInstanceAtDepth(_loc1_) == undefined)
  839.       {
  840.          break;
  841.       }
  842.       _loc1_ = _loc1_ + 1;
  843.    }
  844.    return _loc1_;
  845. }
  846. function chercheDepthMoins(myMc, myDepth)
  847. {
  848.    var _loc1_ = myDepth;
  849.    while(_loc1_ > -16383)
  850.    {
  851.       if(myMc.getInstanceAtDepth(_loc1_) == undefined)
  852.       {
  853.          break;
  854.       }
  855.       _loc1_ = _loc1_ - 1;
  856.    }
  857.    return _loc1_;
  858. }
  859. function changeST(myST)
  860. {
  861.    trace("changeST   : " + myST);
  862.    if(myST == "1")
  863.    {
  864.       gST = 1;
  865.       if(gCommentOn !== undefined)
  866.       {
  867.          gereTextes.afficheST(gCommentOn.id);
  868.       }
  869.    }
  870.    else
  871.    {
  872.       sousTitre = 0;
  873.       gST = 0;
  874.       gereTextes.masqueST(this);
  875.    }
  876. }
  877. function changeMusicOn(myChangeMusicOn)
  878. {
  879.    trace("changeMusicOn   : " + myChangeMusicOn);
  880.    switch(String(myChangeMusicOn))
  881.    {
  882.       case "1":
  883.          gMusicOn = 1;
  884.          if(gMusic == undefined)
  885.          {
  886.             gMusic = gBruitageName + "MU";
  887.          }
  888.          trace("changeMusicOn2   : " + gMusic + " - " + gVolume);
  889.          if(gBlockMusic == undefined)
  890.          {
  891.             if(gCommentOn !== undefined)
  892.             {
  893.                soundObjects[gMusic].setVolume(gVolume * 0.4);
  894.             }
  895.             else
  896.             {
  897.                soundObjects[gMusic].setVolume(gVolume);
  898.             }
  899.          }
  900.          else
  901.          {
  902.             soundObjects[gMusic].setVolume(0);
  903.          }
  904.          soundObjects[gMusic].start(0,1000);
  905.          break;
  906.       case "0":
  907.          soundObjects[gMusic].stop();
  908.          gMusicOn = 0;
  909.          break;
  910.       default:
  911.          if(gMusic !== undefined)
  912.          {
  913.             soundObjects[gMusic].stop();
  914.          }
  915.          gMusic = gBruitageName + myChangeMusicOn;
  916.          if(gMusicOn == 1)
  917.          {
  918.             if(gBlockMusic == undefined)
  919.             {
  920.                if(gCommentOn !== undefined)
  921.                {
  922.                   soundObjects[gMusic].setVolume(gVolume * 0.4);
  923.                }
  924.                else
  925.                {
  926.                   soundObjects[gMusic].setVolume(gVolume);
  927.                }
  928.             }
  929.             else
  930.             {
  931.                soundObjects[gMusic].setVolume(0);
  932.             }
  933.             soundObjects[gMusic].start(0,1000);
  934.          }
  935.    }
  936. }
  937. function changeVolume(myChangeVolume)
  938. {
  939.    trace("changeVolume   : " + myChangeVolume);
  940.    gVolume = Number(myChangeVolume);
  941.    if(gCommentOn !== undefined)
  942.    {
  943.       gCommentOn.setVolume(gVolume);
  944.       if(gMusicOn == 1)
  945.       {
  946.          soundObjects[gMusic].setVolume(gVolume * 0.4);
  947.       }
  948.    }
  949.    else if(gMusicOn == 1)
  950.    {
  951.       soundObjects[gMusic].setVolume(gVolume);
  952.    }
  953. }
  954. function DesactiveBZ()
  955. {
  956.    BT_BZ.useHandCursor = false;
  957.    BT_BZ.gBZactif = 0;
  958. }
  959. function ActiveBZ()
  960. {
  961.    BT_BZ.useHandCursor = true;
  962.    BT_BZ.gBZactif = 1;
  963. }
  964. function getRessourceByID(attributeValue, typeRessource)
  965. {
  966.    var _loc2_ = this.moduleInfo.filterNode(this.moduleInfo.returnNodeByPath("Resources.ResourcesZip"),"type",typeRessource);
  967.    mySound = undefined;
  968.    mySound = this.recusiveGetSoundByAttribute(_loc2_,"id",attributeValue);
  969.    if(mySound == undefined)
  970.    {
  971.       trace(attributeValue + " n\'existe pas dans XML");
  972.    }
  973.    return mySound;
  974. }
  975. function getSoundByID(attributeValue)
  976. {
  977.    var _loc2_ = this.moduleInfo.filterNode(this.moduleInfo.returnNodeByPath("Resources.ResourcesZip"),"type","mp3");
  978.    mySound = undefined;
  979.    mySound = this.recusiveGetSoundByAttribute(_loc2_,"id",attributeValue);
  980.    if(mySound == undefined)
  981.    {
  982.       trace(attributeValue + " n\'existe pas dans XML");
  983.    }
  984.    return mySound;
  985. }
  986. function recusiveGetSoundByAttribute(node, attribute, attributeValue)
  987. {
  988.    var _loc2_ = 0;
  989.    while(_loc2_ < node.childNodes.length)
  990.    {
  991.       if(node.childNodes[_loc2_].attributes[attribute] == attributeValue)
  992.       {
  993.          mySound = node.childNodes[_loc2_];
  994.          break;
  995.       }
  996.       if(node.childNodes[_loc2_].hasChildNodes())
  997.       {
  998.          this.recusiveGetSoundByAttribute(node.childNodes[_loc2_],attribute,attributeValue);
  999.       }
  1000.       _loc2_ = _loc2_ + 1;
  1001.    }
  1002.    return mySound;
  1003. }
  1004. function gereCursor(myCursor)
  1005. {
  1006.    switch(myCursor)
  1007.    {
  1008.       case 1:
  1009.       case "fleche":
  1010.          myCursor = "fleche";
  1011.          break;
  1012.       case 2:
  1013.       case "doigt":
  1014.          myCursor = "doigt";
  1015.          break;
  1016.       case 3:
  1017.       case "mainO":
  1018.          myCursor = "mainO";
  1019.          break;
  1020.       case 4:
  1021.       case "mainF":
  1022.          myCursor = "mainF";
  1023.          break;
  1024.       case 0:
  1025.       case "O":
  1026.          myCursor = "O";
  1027.    }
  1028.    _global.CURSEUR.Action(myCursor);
  1029. }
  1030. function ConvertCoord(mc_src, mc_dest)
  1031. {
  1032.    var _loc1_ = {x:0,y:0};
  1033.    mc_src.localToGlobal(_loc1_);
  1034.    mc_dest.globalToLocal(_loc1_);
  1035.    return _loc1_;
  1036. }
  1037. function OnPadRollOver()
  1038. {
  1039.    if(gDrag !== undefined)
  1040.    {
  1041.    }
  1042. }
  1043. function OnPadRollOut()
  1044. {
  1045.    if(gDrag !== undefined)
  1046.    {
  1047.    }
  1048. }
  1049. function ModulePause()
  1050. {
  1051.    trace("pause ModulePause");
  1052.    if(gListeInterval !== undefined)
  1053.    {
  1054.       pauseIntervals();
  1055.    }
  1056.    _global.pauseOnMod = true;
  1057.    _moteur_.activePause(this);
  1058.    if(TweenWIKIx !== undefined)
  1059.    {
  1060.       TweenWIKIx.stop();
  1061.       TweenWIKIy.stop();
  1062.       TweenBUGx.stop();
  1063.       TweenBUGy.stop();
  1064.       TweenSPAMx.stop();
  1065.       TweenSPAMy.stop();
  1066.       TweenLIZZx.stop();
  1067.       TweenLIZZy.stop();
  1068.       TweenTOTOx.stop();
  1069.       TweenTOTOy.stop();
  1070.    }
  1071.    if(FLVLecture !== undefined)
  1072.    {
  1073.       FLVLecture.pause();
  1074.    }
  1075. }
  1076. function ModuleResume()
  1077. {
  1078.    trace("pause ModuleResume");
  1079.    if(gListeInterval !== undefined)
  1080.    {
  1081.       repriseIntervals();
  1082.    }
  1083.    _global.pauseOnMod = undefined;
  1084.    _moteur_.desactivePause(this);
  1085.    if(TweenWIKIx !== undefined)
  1086.    {
  1087.       TweenWIKIx.resume();
  1088.       TweenWIKIy.resume();
  1089.       TweenBUGx.resume();
  1090.       TweenBUGy.resume();
  1091.       TweenSPAMx.resume();
  1092.       TweenSPAMy.resume();
  1093.       TweenLIZZx.resume();
  1094.       TweenLIZZy.resume();
  1095.       TweenTOTOx.resume();
  1096.       TweenTOTOy.resume();
  1097.    }
  1098.    if(FLVLecture !== undefined)
  1099.    {
  1100.       FLVLecture.play();
  1101.    }
  1102. }
  1103. function _setInterval(p)
  1104. {
  1105.    trace("cree  interval " + p.nomInterval);
  1106.    if(gListeInterval == undefined)
  1107.    {
  1108.       gListeInterval = [];
  1109.       gListeIntervalNom = [];
  1110.       gListeIntervalTime = [];
  1111.    }
  1112.    gListeInterval.push(p);
  1113.    gListeIntervalNom.push(p.nomInterval);
  1114.    gListeIntervalTime.push(getTimer());
  1115.    p.mc[p.nomInterval] = setInterval(p.mc,p.fonction,p.duree,p.reprise);
  1116.    trace("p.mc = " + p.mc);
  1117. }
  1118. function _clearInterval(lNom)
  1119. {
  1120.    trace("virer " + lNom + " dans gListeIntervalNom = " + gListeIntervalNom);
  1121.    var _loc1_ = getPos(gListeIntervalNom,lNom);
  1122.    if(_loc1_ !== -1)
  1123.    {
  1124.       trace("myPos = " + _loc1_);
  1125.       var _loc2_ = gListeInterval[_loc1_].mc;
  1126.       trace("il y est " + _loc2_);
  1127.       clearInterval(_loc2_[lNom]);
  1128.       gListeInterval.splice(_loc1_,1);
  1129.       gListeIntervalNom.splice(_loc1_,1);
  1130.       gListeIntervalTime.splice(_loc1_,1);
  1131.       if(gListeInterval.length == 0)
  1132.       {
  1133.          gListeInterval = undefined;
  1134.          gListeIntervalNom = undefined;
  1135.          gListeIntervalTime = undefined;
  1136.       }
  1137.    }
  1138. }
  1139. function pauseIntervals()
  1140. {
  1141.    trace("pauseIntervals");
  1142.    var _loc3_ = gListeInterval.length;
  1143.    if(_loc3_ > 0)
  1144.    {
  1145.       gListePauseInterval = [];
  1146.       var _loc1_ = 0;
  1147.       while(_loc1_ < _loc3_)
  1148.       {
  1149.          var _loc2_ = gListeInterval[_loc1_].mc;
  1150.          gListePauseInterval.push(getTimer() - gListeIntervalTime[_loc1_]);
  1151.          trace("IntervalNom = " + gListeIntervalNom[_loc1_]);
  1152.          clearInterval(_loc2_[gListeIntervalNom[_loc1_]]);
  1153.          _loc1_ = _loc1_ + 1;
  1154.       }
  1155.    }
  1156.    gDureePause = 0;
  1157.    gTopPause = getTimer();
  1158. }
  1159. function repriseIntervals()
  1160. {
  1161.    trace("repriseIntervals");
  1162.    gDureePause += getTimer() - gTopPause;
  1163.    trace("gDureePause = " + gDureePause);
  1164.    var _loc6_ = gListeInterval.length;
  1165.    if(_loc6_ > 0)
  1166.    {
  1167.       var _loc1_ = 0;
  1168.       while(_loc1_ < _loc6_)
  1169.       {
  1170.          var _loc4_ = gListeInterval[_loc1_];
  1171.          var _loc3_ = _loc4_.duree;
  1172.          var _loc2_ = _loc3_ - gListePauseInterval[_loc1_];
  1173.          trace("myDureeRestant = " + _loc2_);
  1174.          gListeInterval[_loc1_].duree = _loc2_;
  1175.          gListeIntervalTime[_loc1_] = getTimer();
  1176.          var _loc5_ = gListeInterval[_loc1_].mc;
  1177.          _loc5_[gListeIntervalNom[_loc1_]] = setInterval(gListeInterval[_loc1_].mc,gListeInterval[_loc1_].fonction,gListeInterval[_loc1_].duree,1);
  1178.          _loc1_ = _loc1_ + 1;
  1179.       }
  1180.    }
  1181. }
  1182. function initMoteur()
  1183. {
  1184.    trace(" ____ __ initMoteur _ __ _");
  1185.    var _loc4_ = this;
  1186.    var _loc5_ = _loc4_.createEmptyMovieClip("_moteur_",this.getNextHighestDepth());
  1187.    this.mclR = new MovieClipLoader();
  1188.    var _loc3_ = this.prodPath + "/moteur.swf";
  1189.    this.mclR.loadClip(_loc3_,_loc5_);
  1190.    this.mclR.onLoadInit = function(myClip)
  1191.    {
  1192.       trace("onLoadInit _moteur_" + _root);
  1193.       _root.ChargeMoteur();
  1194.    };
  1195. }
  1196. function initLib(nom_lib)
  1197. {
  1198.    trace(" ____ __ initLib _ __ _" + gHotePath);
  1199.    var _loc4_ = this;
  1200.    var _loc6_ = _loc4_.createEmptyMovieClip("_" + nom_lib + "_",this.getNextHighestDepth());
  1201.    var _loc3_ = gLibsPath + "/" + nom_lib + "/" + nom_lib + ".swf";
  1202.    this.mclR = new MovieClipLoader();
  1203.    this.mclR.loadClip(_loc3_,_loc6_);
  1204.    this.mclR.onLoadInit = function(myClip)
  1205.    {
  1206.       trace("onLoadInit " + myClip._name);
  1207.       myClip.ChargeMoteur();
  1208.       _root.Init();
  1209.    };
  1210. }
  1211. function initModuleMoteur(nom_lib)
  1212. {
  1213.    trace(" ____ __ initLib _ __ _" + gHotePath);
  1214.    var _loc4_ = this;
  1215.    var _loc5_ = _loc4_.createEmptyMovieClip("_" + nom_lib + "_",this.getNextHighestDepth());
  1216.    var _loc3_ = this.gModulePath + nom_lib + ".swf";
  1217.    this.mclR = new MovieClipLoader();
  1218.    this.mclR.loadClip(_loc3_,_loc5_);
  1219.    this.mclR.onLoadInit = function(myClip)
  1220.    {
  1221.       trace("onLoadInit " + myClip._name);
  1222.       myClip.ChargeMoteur();
  1223.       _root.Init();
  1224.    };
  1225. }
  1226. stop();
  1227. this._lockroot = true;
  1228. this.prodVersion = "prod_gen_XB";
  1229. if(_global.gModulePath == undefined)
  1230. {
  1231.    this.gModulePath = _global.gModulePath = "";
  1232. }
  1233. else
  1234. {
  1235.    this.gModulePath = _global.gModulePath;
  1236. }
  1237. _global._MOD_ = this;
  1238. this.CIBLE = this;
  1239. if(_global.HOTE != undefined)
  1240. {
  1241.    MovieClip.prototype.gHotePath = _global.gPARAMS.HOTE_DIR + "/DATA/HOTE";
  1242. }
  1243. else
  1244. {
  1245.    MovieClip.prototype.gHotePath = "../../HOTE";
  1246. }
  1247. this.prodPath = gHotePath + "/" + this.prodVersion;
  1248. MovieClip.prototype.gLibsPath = gHotePath + "/libs";
  1249. _global.stopComment = stopComment;
  1250. _global.joueSon = joueSon;
  1251. _root.creerClicZap = creerClicZap;
  1252. _global.joueBruitage = joueBruitage;
  1253. _global.stopBruitage = stopBruitage;
  1254. _global.stopBruit = stopBruit;
  1255. _global.gimme2digits = gimme2digits;
  1256. _global.randomValue = randomValue;
  1257. this.randRange = randomValue;
  1258. _global.chercheDepthPlus = chercheDepthPlus;
  1259. _global.chercheDepthMoins = chercheDepthMoins;
  1260. _global.DesactiveBZ = DesactiveBZ;
  1261. _root.DesactiveBZ = DesactiveBZ;
  1262. _global.ActiveBZ = ActiveBZ;
  1263. _root.ActiveBZ = ActiveBZ;
  1264. _global.gereCursor = gereCursor;
  1265. this.initVariables = function()
  1266. {
  1267.    trace("initVariables()");
  1268.    this.gotoAndStop("INIT");
  1269. };
  1270. MovieClip.prototype._xtrace_ = undefined;
  1271. MovieClip.prototype._xlib1_ = undefined;
  1272. this.Init = function()
  1273. {
  1274.    trace(" ____ __ Init()__ _ __ _");
  1275.    if(_xtrace_ == undefined)
  1276.    {
  1277.       initLib("xtrace");
  1278.       return undefined;
  1279.    }
  1280.    if(_xlib1_ == undefined)
  1281.    {
  1282.       initLib("xlib1");
  1283.       return undefined;
  1284.    }
  1285.    this.initMoteur();
  1286. };
  1287. this.InitOk = function()
  1288. {
  1289.    trace("InitOk");
  1290.    if(HOTE == undefined)
  1291.    {
  1292.       this.Start();
  1293.    }
  1294.    else
  1295.    {
  1296.       HOTE.InitFin(this);
  1297.    }
  1298. };
  1299. this.Start = function()
  1300. {
  1301.    gereCursor("fleche");
  1302.    this.gotoAndStop("START");
  1303. };
  1304. if(HOTE == undefined)
  1305. {
  1306.    this.onEnterFrame = function()
  1307.    {
  1308.       var _loc2_ = this.getBytesLoaded();
  1309.       var _loc3_ = this.getBytesTotal();
  1310.       if(_loc2_ >= _loc3_)
  1311.       {
  1312.          this.Init();
  1313.          delete this.onEnterFrame;
  1314.       }
  1315.    };
  1316. }
  1317. stop();
  1318.