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