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