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