home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 136 / MOBICLIC136.ISO / pc / DATA / DSS136 / DSS136_04 / DSS136_04.swf / scripts / frame_1 / DoAction.as
Text File  |  2011-07-20  |  26KB  |  1,044 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.          DesactiveOEIL();
  45.          if(BT_OEIL.gEtat !== 3)
  46.          {
  47.             trace("E3");
  48.             BT_OEIL.gotoAndPlay("E3");
  49.          }
  50.          else
  51.          {
  52.             trace("PARLE");
  53.             BT_OEIL.OEIL_P.gotoAndPlay("parle");
  54.          }
  55.          break;
  56.       case "ze":
  57.       case "ZE":
  58.          trace("-------  ZE on-----------");
  59.          DesactiveOEIL();
  60.          if(BT_OEIL.gEtat !== 3)
  61.          {
  62.             BT_OEIL.gotoAndPlay("E3");
  63.          }
  64.          else
  65.          {
  66.             BT_OEIL.OEIL_P.gotoAndPlay("parle");
  67.          }
  68.          afficherRolls();
  69.    }
  70. }
  71. function testeFinCommentSpecial()
  72. {
  73.    switch(gCommentOn.id.split("_")[gCommentOn.id.split("_").length - 1])
  74.    {
  75.       case "bz":
  76.       case "BZ":
  77.          trace("-------  BZ off-----------");
  78.          ActiveOEIL();
  79.          BT_OEIL.OEIL_P.gotoAndPlay("rentre");
  80.          BT_OEIL.gClicOn = undefined;
  81.          break;
  82.       case "ze":
  83.       case "ZE":
  84.          trace("-------  ZE off-----------");
  85.          ActiveOEIL();
  86.          BT_OEIL.OEIL_P.gotoAndPlay("rentre");
  87.          BT_OEIL.gClicOn = undefined;
  88.          masquerRolls();
  89.    }
  90. }
  91. function stopComment()
  92. {
  93.    if(gCommentOn !== undefined)
  94.    {
  95.       testeFinCommentSpecial();
  96.       delete gCommentOn.onSoundComplete;
  97.       gCommentOn.stop();
  98.       gCommentOn = undefined;
  99.       if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  100.       {
  101.          soundObjects[gMusic].setVolume(gVolume);
  102.       }
  103.       if(gPauseOn == undefined || gPauseOn == 0)
  104.       {
  105.          removeMovieClip("mcClicZap");
  106.       }
  107.       gBlockST = undefined;
  108.       gereTextes.masqueST();
  109.       if(gClipTarget !== undefined)
  110.       {
  111.          gClipTarget.gotoAndStop(gClipTargetLabel);
  112.          gClipTarget = undefined;
  113.          gClipTargetLabel = undefined;
  114.       }
  115.    }
  116. }
  117. function pauseComment()
  118. {
  119.    trace("pauseComment " + gCommentOn);
  120.    if(gCommentOn !== undefined)
  121.    {
  122.       gCommentOn.stop();
  123.       mcClicZap._visible = false;
  124.    }
  125. }
  126. function continueComment()
  127. {
  128.    trace("continueComment " + gCommentOn);
  129.    if(gCommentOn !== undefined)
  130.    {
  131.       gCommentOn.start(gCommentOn.position / 1000);
  132.       mcClicZap._visible = true;
  133.    }
  134. }
  135. function joueSon(p)
  136. {
  137.    var _loc4_ = p.nomSon;
  138.    gSoundString = _loc4_;
  139.    if(p.gNextLabel != undefined)
  140.    {
  141.       _root.gNextLabel = p.gNextLabel;
  142.    }
  143.    if(p.mc !== undefined)
  144.    {
  145.       gClipRef = p.mc;
  146.    }
  147.    else
  148.    {
  149.       gClipRef = _root;
  150.    }
  151.    if(p.zapBlock !== undefined)
  152.    {
  153.       gClicZap = p.zapBlock;
  154.    }
  155.    else
  156.    {
  157.       gClicZap = "ZAP_BLOCK";
  158.    }
  159.    if(p.actionFin !== undefined)
  160.    {
  161.       gActionFinSon = p.actionFin;
  162.    }
  163.    else
  164.    {
  165.       gActionFinSon = "PLAY";
  166.    }
  167.    stopComment();
  168.    if(p.mcCible !== undefined)
  169.    {
  170.       if(typeof p.mcCible == "movieclip")
  171.       {
  172.          gClipTarget = p.mcCible;
  173.       }
  174.       else
  175.       {
  176.          gClipTarget = gClipRef[p.mcCible];
  177.       }
  178.       if(p.mcLabelOut !== undefined)
  179.       {
  180.          gClipTargetLabel = p.mcLabelOut;
  181.       }
  182.       else
  183.       {
  184.          gClipTargetLabel = gClipTarget._currentframe;
  185.       }
  186.       if(p.mcLabelIn !== undefined)
  187.       {
  188.          gClipTarget.gotoAndPlay(p.mcLabelIn);
  189.       }
  190.       else
  191.       {
  192.          gClipTarget.gotoAndPlay("parle");
  193.       }
  194.    }
  195.    gCommentName = "S_" + gLangue + "_" + gModuleName + "_";
  196.    trace("joueSon " + gCommentName + _loc4_);
  197.    mySound = soundObjects[gCommentName + _loc4_];
  198.    _root.afficherMascottes(p.Mascottes);
  199.    if(mySound !== undefined)
  200.    {
  201.       gCommentOn = mySound;
  202.       gCommentOn.p = p;
  203.       gCommentOn.id = gCommentName + _loc4_;
  204.       testeDebutCommentSpecial();
  205.       if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  206.       {
  207.          soundObjects[gMusic].setVolume(gVolume * 40 / 100);
  208.       }
  209.       mySound.setVolume(gVolume);
  210.       if(gCommentOnPausePos !== undefined)
  211.       {
  212.          mySound.start(gCommentOnPausePos / 1000);
  213.          gCommentOnPause = undefined;
  214.          gCommentOnPausePos = undefined;
  215.       }
  216.       else
  217.       {
  218.          mySound.start();
  219.       }
  220.    }
  221.    else
  222.    {
  223.       trace("______" + getSoundByID(gCommentName + _loc4_) + gCommentName);
  224.       var _loc5_ = getSoundByID(gCommentName + _loc4_);
  225.       if(_loc5_ !== undefined)
  226.       {
  227.          mySound = new Sound();
  228.          mySound.onLoad = function(success)
  229.          {
  230.             if(success)
  231.             {
  232.                if(gCommentOnPausePos !== undefined)
  233.                {
  234.                   mySound.start(gCommentOnPausePos / 1000);
  235.                   gCommentOnPause = undefined;
  236.                   gCommentOnPausePos = undefined;
  237.                }
  238.                else
  239.                {
  240.                   mySound.start();
  241.                }
  242.             }
  243.          };
  244.          mySound.loadSound(this.gModulePath + _loc5_.attributes.src,true);
  245.          gCommentOn = mySound;
  246.          gCommentOn.p = p;
  247.          gCommentOn.id = gCommentName + _loc4_;
  248.          testeDebutCommentSpecial();
  249.          if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  250.          {
  251.             soundObjects[gMusic].setVolume(gVolume * 40 / 100);
  252.          }
  253.       }
  254.    }
  255.    if(mySound == undefined)
  256.    {
  257.       return undefined;
  258.    }
  259.    mySound.onSoundComplete = commentFini;
  260.    if(gClicZap !== "NOZAP_NOBLOCK")
  261.    {
  262.       trace("creerRectangle " + creerRectangle + " " + gHeight + " " + gWidth);
  263.       mcClicZap = creerRectangle({nom:"mcClicZap",pere:_root,level:15000,width:gWidth,height:gHeight,x:0,y:0,alpha:0});
  264.       switch(gClicZap.split("_")[0])
  265.       {
  266.          case "ZAP":
  267.             mcClicZap.useHandCursor = false;
  268.             mcClicZap.onPress = function()
  269.             {
  270.                trace("clic zap son");
  271.                stopSon();
  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[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_._alpha = _loc17_;
  339.    _loc3_.beginFill(_loc12_,100);
  340.    _loc3_.moveTo(_loc6_,_loc5_ - _loc4_);
  341.    _loc3_.lineTo(_loc6_,_loc7_ + _loc4_);
  342.    _loc3_.curveTo(_loc6_,_loc7_,_loc6_ + _loc4_,_loc7_);
  343.    _loc3_.lineTo(_loc8_ - _loc4_,_loc7_);
  344.    _loc3_.curveTo(_loc8_,_loc7_,_loc8_,_loc7_ + _loc4_);
  345.    _loc3_.lineTo(_loc8_,_loc5_ - _loc4_);
  346.    _loc3_.curveTo(_loc8_,_loc5_,_loc8_ - _loc4_,_loc5_);
  347.    _loc3_.lineTo(_loc6_ + _loc4_,_loc5_);
  348.    _loc3_.curveTo(_loc6_,_loc5_,_loc6_,_loc5_ - _loc4_);
  349.    _loc3_.endFill();
  350.    _loc3_._x = _loc15_;
  351.    _loc3_._y = _loc13_;
  352.    return _loc3_;
  353. }
  354. function stopSon()
  355. {
  356.    gCommentOn.stop();
  357.    commentFini();
  358. }
  359. function commentFini()
  360. {
  361.    testeFinCommentSpecial();
  362.    if(gClicZap !== "NOZAP_NOBLOCK")
  363.    {
  364.       removeMovieClip("mcClicZap");
  365.    }
  366.    gCommentOn = undefined;
  367.    gBlockST = undefined;
  368.    gereTextes.masqueST();
  369.    if(gMusicOn == 1 && gMusic !== undefined && gBlockMusic == undefined)
  370.    {
  371.       soundObjects[gMusic].setVolume(gVolume);
  372.    }
  373.    if(gClipTarget !== undefined)
  374.    {
  375.       gClipTarget.gotoAndStop(gClipTargetLabel);
  376.       gClipTarget = undefined;
  377.       gClipTargetLabel = undefined;
  378.    }
  379.    _root.afficherMascottes();
  380.    switch(gActionFinSon)
  381.    {
  382.       case "RIEN":
  383.          break;
  384.       case "PLAY":
  385.          if(_root.gNextLabel == undefined)
  386.          {
  387.             if(gLineaireOn != undefined)
  388.             {
  389.                if((_loc0_ = gLineaireOn) !== "_")
  390.                {
  391.                   lSonSuivant = gLineaireOn + gimme2digits(Number(gSoundString.split("_")[gSoundString.split("_").length - 1]) + 1);
  392.                   lLabel = lSonSuivant;
  393.                }
  394.                else
  395.                {
  396.                   lSonSuivant = gimme2digits(Number(gSoundString.split("_")[gSoundString.split("_").length - 1]) + 1);
  397.                   lLabel = gLineaireOn + lSonSuivant;
  398.                }
  399.                joueSon({mc:gClipRef,nomSon:lSonSuivant,zapBlock:gClicZap,actionFin:gActionFinSon});
  400.                gClipRef.gotoAndStop(lLabel);
  401.             }
  402.             else
  403.             {
  404.                gClipRef.play();
  405.             }
  406.          }
  407.          else
  408.          {
  409.             gClipRef.gotoAndPlay(_root.gNextLabel);
  410.             _root.gNextLabel = undefined;
  411.             gLineaireOn = undefined;
  412.          }
  413.          break;
  414.       default:
  415.          _root[gActionFinSon]();
  416.    }
  417. }
  418. function joueBruitage(p)
  419. {
  420.    trace("joueBruitage " + p.nomSon + ",  " + (this.gBruitageName + p.nomSon));
  421.    var _loc3_ = soundObjects[gBruitageName + p.nomSon];
  422.    if(gListeBruitage == undefined)
  423.    {
  424.       gListeBruitage = [];
  425.       gListeA_fin_Bruitage = [];
  426.       gListeLoop_Bruitage = [];
  427.    }
  428.    _loc3_.setVolume(gVolume);
  429.    _loc3_.id = p.nomSon;
  430.    gListeBruitage.push(_loc3_.id);
  431.    if(p.actionFin !== undefined)
  432.    {
  433.       gActionFinBruitage = p.actionFin;
  434.       gListeA_fin_Bruitage.push(gActionFinBruitage);
  435.    }
  436.    else
  437.    {
  438.       gActionFinBruitage = undefined;
  439.       gListeA_fin_Bruitage.push("");
  440.    }
  441.    _loc3_.p = p;
  442.    _loc3_.onSoundComplete = mx.utils.Delegate.create(_loc3_,finBruitage);
  443.    if(p.loopSon == undefined)
  444.    {
  445.       _loc3_.start(p.offset);
  446.       gListeLoop_Bruitage.push("");
  447.    }
  448.    else
  449.    {
  450.       _loc3_.start(p.offset,p.loopSon);
  451.       gListeLoop_Bruitage.push(p.loopSon);
  452.    }
  453.    if(_loc3_ == undefined)
  454.    {
  455.       trace("joueBruitage : " + p.nomSon + " : " + _loc3_);
  456.    }
  457. }
  458. function stopBruitage(p)
  459. {
  460.    trace("stopBruitage");
  461.    var _loc1_ = soundObjects[gBruitageName + p.nomSon];
  462.    finBruitage(p.nomSon);
  463.    _loc1_.stop();
  464. }
  465. function finBruitage(lSon)
  466. {
  467.    if(lSon == undefined)
  468.    {
  469.       lSon = this.id;
  470.    }
  471.    trace("lson = " + lSon);
  472.    if(gListeBruitage !== undefined)
  473.    {
  474.       if(getPos(gListeBruitage,lSon) !== -1)
  475.       {
  476.          if(gListeA_fin_Bruitage[getPos(gListeBruitage,lSon)] !== "")
  477.          {
  478.             if(typeof gListeA_fin_Bruitage[getPos(gListeBruitage,lSon)] == "string")
  479.             {
  480.                gClipGen[gListeA_fin_Bruitage[getPos(gListeBruitage,lSon)]]();
  481.             }
  482.             else
  483.             {
  484.                gListeA_fin_Bruitage[getPos(gListeBruitage,lSon)].call(this.p.MC);
  485.             }
  486.          }
  487.          gListeA_fin_Bruitage.splice(getPos(gListeBruitage,lSon),1);
  488.          gListeLoop_Bruitage.splice(getPos(gListeBruitage,lSon),1);
  489.          gListeBruitage.splice(getPos(gListeBruitage,lSon),1);
  490.          if(gListeBruitage.length == 0)
  491.          {
  492.             gListeBruitage = undefined;
  493.             gListeA_fin_Bruitage = undefined;
  494.             gListeLoop_Bruitage = undefined;
  495.          }
  496.       }
  497.    }
  498. }
  499. function getPos(myList, myValue)
  500. {
  501.    lPresent = -1;
  502.    maPosition = 0;
  503.    while(maPosition <= myList.length)
  504.    {
  505.       if(myList[maPosition] == myValue)
  506.       {
  507.          lPresent = maPosition;
  508.          break;
  509.       }
  510.       maPosition++;
  511.    }
  512.    return lPresent;
  513. }
  514. function trouvePosMax(myList)
  515. {
  516.    lMax = myList[0];
  517.    lPosMax = 0;
  518.    i = 1;
  519.    while(i <= myList.length)
  520.    {
  521.       if(myList[i] > lMax)
  522.       {
  523.          lMax = myList[i];
  524.          lPosMax = i;
  525.       }
  526.       i++;
  527.    }
  528.    return lPosMax;
  529. }
  530. function duplicate(myList)
  531. {
  532.    newList = [];
  533.    i = 0;
  534.    while(i <= myList.length - 1)
  535.    {
  536.       newList.push(myList[i]);
  537.       i++;
  538.    }
  539.    return newList;
  540. }
  541. function randomiseList(myList)
  542. {
  543.    var _loc3_ = duplicate(myList);
  544.    var _loc4_ = [];
  545.    var _loc5_ = _loc3_.length;
  546.    var _loc2_ = 0;
  547.    while(_loc2_ < _loc5_)
  548.    {
  549.       var _loc1_ = randomValue(0,_loc3_.length - 1);
  550.       _loc4_.push(_loc3_[_loc1_]);
  551.       _loc3_.splice(_loc1_,1);
  552.       _loc2_ = _loc2_ + 1;
  553.    }
  554.    return _loc4_;
  555. }
  556. function returnNodeByPathRandomise(nodeSent)
  557. {
  558.    var _loc4_ = new XML();
  559.    var _loc5_ = nodeSent.childNodes.length;
  560.    var _loc1_ = 0;
  561.    while(_loc1_ < _loc5_)
  562.    {
  563.       var _loc2_ = randomValue(0,nodeSent.childNodes.length - 1);
  564.       _loc4_.appendChild(nodeSent.childNodes[_loc2_]);
  565.       _loc1_ = _loc1_ + 1;
  566.    }
  567.    return _loc4_;
  568. }
  569. function zapIntro(myLabel)
  570. {
  571.    mcClicZapIntro = this.createEmptyMovieClip("mcClicZapIntro",16031);
  572.    mcClicZapIntro.attachMovie("ClipInvisible","ClipInvisible",2);
  573.    mcClicZapIntro._width = gClipGen._width;
  574.    mcClicZapIntro._height = gClipGen._height;
  575.    mcClicZapIntro._x = 0;
  576.    mcClicZapIntro._y = 0;
  577.    mcClicZapIntro.useHandCursor = false;
  578.    mcClicZapIntro.onPress = function()
  579.    {
  580.       trace("clic zappIntro " + this);
  581.       stopComment();
  582.       gotoAndPlay(myLabel);
  583.       removeZapIntro();
  584.    };
  585. }
  586. function removeZapIntro()
  587. {
  588.    trace("mcClicZapIntrO " + mcClicZapIntro._name + " " + this);
  589.    if(mcClicZapIntro._x != undefined)
  590.    {
  591.       trace("suppression");
  592.       removeMovieClip(mcClicZapIntro);
  593.    }
  594. }
  595. function onMcOut(myMc)
  596. {
  597.    gereCursor(1);
  598.    if(myMc.pLabelOut == undefined)
  599.    {
  600.       myMc.gotoAndPlay("E1");
  601.    }
  602.    else
  603.    {
  604.       myMc.gotoAndPlay(myMc.pLabelOut);
  605.    }
  606.    if(myMc.pSon.split("")[0] == "B")
  607.    {
  608.       stopBruitage({nomSon:myMc.pSon});
  609.    }
  610.    else
  611.    {
  612.       stopComment();
  613.    }
  614.    if(myMc.pIB !== undefined)
  615.    {
  616.       gereTextes.masqueIB();
  617.    }
  618. }
  619. function onMcOver(p)
  620. {
  621.    var myMc = p.mc;
  622.    myMc.pIB = p.codeIB;
  623.    if(p.nomSon == undefined)
  624.    {
  625.       if(p.nomSonC == undefined)
  626.       {
  627.          myMc.pSon = "B_" + myMc._name.split("_")[1];
  628.       }
  629.       else
  630.       {
  631.          myMc.pSon = p.nomSonC;
  632.       }
  633.    }
  634.    else
  635.    {
  636.       myMc.pSon = p.nomSon;
  637.    }
  638.    if(p.actionFin == undefined)
  639.    {
  640.       myMc.actionFin = "RIEN";
  641.    }
  642.    else
  643.    {
  644.       myMc.actionFin = p.actionFin;
  645.    }
  646.    myMc.pLabelOut = p.mcLabelOut;
  647.    myMc.onRollOver = function()
  648.    {
  649.       gereCursor(2);
  650.       if(p.mcLabelIn == undefined)
  651.       {
  652.          this.gotoAndPlay("E2");
  653.       }
  654.       else
  655.       {
  656.          this.gotoAndPlay(p.mcLabelIn);
  657.       }
  658.       if(this.pSon.split("")[0] == "B")
  659.       {
  660.          joueBruitage({nomSon:this.pSon});
  661.       }
  662.       else
  663.       {
  664.          joueSon({nomSon:this.pSon,zapBlock:"NOZAP_NOBLOCK",actionFin:this.actionFin});
  665.       }
  666.       if(this.pIB !== undefined)
  667.       {
  668.          gereTextes.afficheIB({mc:this,codeIB:this.pIB});
  669.       }
  670.    };
  671.    myMc.onRollOut = myMc.onDragOut = function()
  672.    {
  673.       onMcOut(myMc);
  674.    };
  675. }
  676. function desactiveClip(pClip)
  677. {
  678.    trace(pClip);
  679.    delete pClip.onRollOver;
  680.    delete pClip.onRollOut;
  681.    delete pClip.onDragOut;
  682.    delete pClip.onPress;
  683.    delete pClip.onRelease;
  684.    delete pClip.onReleaseOutside;
  685. }
  686. function afficheClipPos(myMc, myX, myY)
  687. {
  688.    myMc._x = myX;
  689.    myMc._y = myY;
  690.    myMc._visible = true;
  691. }
  692. function gimme2digits(X)
  693. {
  694.    if(Number(X) < 10)
  695.    {
  696.       lX = "0" + Number(X);
  697.    }
  698.    else
  699.    {
  700.       lX = String(X);
  701.    }
  702.    return lX;
  703. }
  704. function randomValue(min, max)
  705. {
  706.    var _loc1_ = Math.floor(Math.random() * (max - min + 1)) + min;
  707.    return _loc1_;
  708. }
  709. function chercheDepthPlus(myMc, myDepth)
  710. {
  711.    var _loc1_ = myDepth;
  712.    while(_loc1_ < 17000)
  713.    {
  714.       if(myMc.getInstanceAtDepth(_loc1_) == undefined)
  715.       {
  716.          break;
  717.       }
  718.       _loc1_ = _loc1_ + 1;
  719.    }
  720.    return _loc1_;
  721. }
  722. function chercheDepthMoins(myMc, myDepth)
  723. {
  724.    var _loc1_ = myDepth;
  725.    while(_loc1_ > -16383)
  726.    {
  727.       if(myMc.getInstanceAtDepth(_loc1_) == undefined)
  728.       {
  729.          break;
  730.       }
  731.       _loc1_ = _loc1_ - 1;
  732.    }
  733.    return _loc1_;
  734. }
  735. function changeST(myST)
  736. {
  737.    trace("changeST   : " + myST);
  738.    if(myST == "1")
  739.    {
  740.       gST = 1;
  741.       if(gCommentOn !== undefined)
  742.       {
  743.          gereTextes.afficheST(gCommentOn.id);
  744.       }
  745.    }
  746.    else
  747.    {
  748.       sousTitre = 0;
  749.       gST = 0;
  750.       gereTextes.masqueST(this);
  751.    }
  752. }
  753. function changeMusicOn(myChangeMusicOn)
  754. {
  755.    trace("changeMusicOn   : " + myChangeMusicOn);
  756.    switch(String(myChangeMusicOn))
  757.    {
  758.       case "1":
  759.          gMusicOn = 1;
  760.          if(gMusic == undefined)
  761.          {
  762.             gMusic = gBruitageName + "MU";
  763.          }
  764.          trace("changeMusicOn2   : " + gMusic + " - " + gVolume);
  765.          if(gBlockMusic == undefined)
  766.          {
  767.             if(gCommentOn !== undefined)
  768.             {
  769.                soundObjects[gMusic].setVolume(gVolume * 0.4);
  770.             }
  771.             else
  772.             {
  773.                soundObjects[gMusic].setVolume(gVolume);
  774.             }
  775.          }
  776.          else
  777.          {
  778.             soundObjects[gMusic].setVolume(0);
  779.          }
  780.          soundObjects[gMusic].start(0,1000);
  781.          break;
  782.       case "0":
  783.          soundObjects[gMusic].stop();
  784.          gMusicOn = 0;
  785.          break;
  786.       default:
  787.          if(gMusic !== undefined)
  788.          {
  789.             soundObjects[gMusic].stop();
  790.          }
  791.          gMusic = gBruitageName + myChangeMusicOn;
  792.          trace("gMusic : " + gMusic);
  793.          trace("gMusicOn : " + gMusicOn);
  794.          if(gMusicOn == 1)
  795.          {
  796.             if(gBlockMusic == undefined)
  797.             {
  798.                if(gCommentOn !== undefined)
  799.                {
  800.                   soundObjects[gMusic].setVolume(gVolume * 0.4);
  801.                }
  802.                else
  803.                {
  804.                   soundObjects[gMusic].setVolume(gVolume);
  805.                }
  806.             }
  807.             else
  808.             {
  809.                soundObjects[gMusic].setVolume(0);
  810.             }
  811.             soundObjects[gMusic].start(0,1000);
  812.             trace("soundObjects[gMusic] : " + soundObjects[gMusic]);
  813.          }
  814.    }
  815. }
  816. function changeVolume(myChangeVolume)
  817. {
  818.    trace("changeVolume   : " + myChangeVolume);
  819.    gVolume = Number(myChangeVolume);
  820.    if(gCommentOn !== undefined)
  821.    {
  822.       gCommentOn.setVolume(gVolume);
  823.       if(gMusicOn == 1)
  824.       {
  825.          soundObjects[gMusic].setVolume(gVolume * 0.4);
  826.       }
  827.    }
  828.    else if(gMusicOn == 1)
  829.    {
  830.       soundObjects[gMusic].setVolume(gVolume);
  831.    }
  832. }
  833. function DesactiveBZ()
  834. {
  835.    BT_BZ.useHandCursor = false;
  836.    BT_BZ.gBZactif = 0;
  837. }
  838. function ActiveBZ()
  839. {
  840.    BT_BZ.useHandCursor = true;
  841.    BT_BZ.gBZactif = 1;
  842. }
  843. function getRessourceByID(attributeValue, typeRessource)
  844. {
  845.    var _loc2_ = this.moduleInfo.filterNode(this.moduleInfo.returnNodeByPath("Resources.ResourcesZip"),"type",typeRessource);
  846.    mySound = undefined;
  847.    mySound = this.recusiveGetSoundByAttribute(_loc2_,"id",attributeValue);
  848.    if(mySound == undefined)
  849.    {
  850.       trace(attributeValue + " n\'existe pas dans XML");
  851.    }
  852.    return mySound;
  853. }
  854. function getSoundByID(attributeValue)
  855. {
  856.    var _loc2_ = this.moduleInfo.filterNode(this.moduleInfo.returnNodeByPath("Resources.ResourcesZip"),"type","mp3");
  857.    mySound = undefined;
  858.    mySound = this.recusiveGetSoundByAttribute(_loc2_,"id",attributeValue);
  859.    if(mySound == undefined)
  860.    {
  861.       trace("/!\\" + attributeValue + " n\'existe pas dans XML");
  862.    }
  863.    return mySound;
  864. }
  865. function recusiveGetSoundByAttribute(node, attribute, attributeValue)
  866. {
  867.    var _loc2_ = 0;
  868.    while(_loc2_ < node.childNodes.length)
  869.    {
  870.       if(node.childNodes[_loc2_].attributes[attribute] == attributeValue)
  871.       {
  872.          mySound = node.childNodes[_loc2_];
  873.          break;
  874.       }
  875.       if(node.childNodes[_loc2_].hasChildNodes())
  876.       {
  877.          this.recusiveGetSoundByAttribute(node.childNodes[_loc2_],attribute,attributeValue);
  878.       }
  879.       _loc2_ = _loc2_ + 1;
  880.    }
  881.    return mySound;
  882. }
  883. function getTextById(attributeValue)
  884. {
  885.    var _loc2_ = {};
  886.    var _loc4_ = _root.moduleInfo.returnNodeByPath("Module.StylesTextes.StylesLM");
  887.    var _loc3_ = _root.moduleInfo.returnNodeByPath("Module." + _root.gLangue + ".LegendesMedias");
  888.    _loc2_.Texte = _root.gereTextes.getTextById(_loc3_,attributeValue);
  889.    return _loc2_;
  890. }
  891. function gereCursor(myCursor)
  892. {
  893.    switch(myCursor)
  894.    {
  895.       case 1:
  896.       case "fleche":
  897.          myCursor = "fleche";
  898.          break;
  899.       case 2:
  900.       case "doigt":
  901.          myCursor = "doigt";
  902.          break;
  903.       case 3:
  904.       case "mainO":
  905.          myCursor = "mainO";
  906.          break;
  907.       case 4:
  908.       case "mainF":
  909.          myCursor = "mainF";
  910.          break;
  911.       case 0:
  912.       case "O":
  913.          myCursor = "O";
  914.    }
  915.    trace("cursor " + myCursor);
  916.    _global.CURSEUR.Action(myCursor);
  917. }
  918. function ConvertCoord(mc_src, mc_dest)
  919. {
  920.    var _loc1_ = {x:0,y:0};
  921.    mc_src.localToGlobal(_loc1_);
  922.    mc_dest.globalToLocal(_loc1_);
  923.    return _loc1_;
  924. }
  925. function initLib(p)
  926. {
  927.    trace(" ____ __ initLib _ __ _");
  928.    var _loc3_ = this;
  929.    var _loc4_ = _loc3_.createEmptyMovieClip("_" + p.nom + "_",this.getNextHighestDepth());
  930.    var _loc5_ = gLibsPath + "/" + nom_lib + "/" + nom_lib + ".swf";
  931.    this.mclR = new MovieClipLoader();
  932.    this.mclR.loadClip(p.url,_loc4_);
  933.    this.mclR.onLoadInit = function(myClip)
  934.    {
  935.       trace("onLoadInit " + myClip._name);
  936.       myClip.ChargeMoteur();
  937.       _root.Init();
  938.    };
  939. }
  940. stop();
  941. this._lockroot = true;
  942. this.prodVersion = "prod_gen_XB";
  943. this.gLabelStartName = "START";
  944. if(_global.gModulePath == undefined)
  945. {
  946.    this.gModulePath = _global.gModulePath = "";
  947. }
  948. else
  949. {
  950.    this.gModulePath = _global.gModulePath;
  951. }
  952. _global._MOD_ = this;
  953. this.CIBLE = this;
  954. if(_global.HOTE != undefined)
  955. {
  956.    MovieClip.prototype.gHotePath = _global.gPARAMS.HOTE_DIR + "/DATA/HOTE";
  957. }
  958. else
  959. {
  960.    MovieClip.prototype.gHotePath = "../../HOTE";
  961. }
  962. this.prodPath = gHotePath + "/" + this.prodVersion;
  963. MovieClip.prototype.gLibsPath = gHotePath + "/libs";
  964. _global.stopComment = stopComment;
  965. _global.joueSon = joueSon;
  966. _root.creerClicZap = creerClicZap;
  967. _global.joueBruitage = joueBruitage;
  968. _global.stopBruitage = stopBruitage;
  969. _global.finBruitage = finBruitage;
  970. _global.gimme2digits = gimme2digits;
  971. this.randRange = randomValue;
  972. _global.chercheDepthPlus = chercheDepthPlus;
  973. _global.chercheDepthMoins = chercheDepthMoins;
  974. _global.DesactiveBZ = DesactiveBZ;
  975. _root.DesactiveBZ = DesactiveBZ;
  976. _global.ActiveBZ = ActiveBZ;
  977. _root.ActiveBZ = ActiveBZ;
  978. _global.gereCursor = gereCursor;
  979. this.initVariables = function()
  980. {
  981.    trace("initVariables()");
  982.    this.gotoAndStop("INIT");
  983. };
  984. _global._o_ = new Object();
  985. MovieClip.prototype._o_ = _o_;
  986. MovieClip.prototype._xlib1_ = undefined;
  987. this.Init = function()
  988. {
  989.    trace("<<<<<<<<<<<<< Init() >>>>>>>>>>>");
  990.    if(_ed_ == undefined)
  991.    {
  992.       initLib({nom:"ed",url:gLibsPath + "/o/ed.swf"});
  993.       return undefined;
  994.    }
  995.    if(_xb_ == undefined)
  996.    {
  997.       initLib({nom:"xb",url:gLibsPath + "/o/xb.swf"});
  998.       return undefined;
  999.    }
  1000.    if(_mod_ == undefined)
  1001.    {
  1002.       initLib({nom:"mod",url:this.gModulePath + "mod.swf"});
  1003.       return undefined;
  1004.    }
  1005.    if(_moteur_ == undefined)
  1006.    {
  1007.       initLib({nom:"moteur",url:this.gModulePath + "moteur.swf"});
  1008.       return undefined;
  1009.    }
  1010. };
  1011. this.InitOk = function()
  1012. {
  1013.    trace("<<<<<<<<<<<<< InitOk() >>>>>>>>>>>");
  1014.    if(HOTE == undefined)
  1015.    {
  1016.       this.Start();
  1017.    }
  1018.    else
  1019.    {
  1020.       HOTE.InitFin(this);
  1021.    }
  1022. };
  1023. this.Start = function()
  1024. {
  1025.    trace("<<<<<<<<<<<<< Start() >>>>>>>>>>>");
  1026.    gereCursor("fleche");
  1027.    _root.gLabelStartName = _root.gLabelStartName != undefined ? _root.gLabelStartName : "START";
  1028.    this.gotoAndStop(_root.gLabelStartName);
  1029. };
  1030. if(HOTE == undefined)
  1031. {
  1032.    this.onEnterFrame = function()
  1033.    {
  1034.       var _loc2_ = this.getBytesLoaded();
  1035.       var _loc3_ = this.getBytesTotal();
  1036.       if(_loc2_ >= _loc3_)
  1037.       {
  1038.          this.Init();
  1039.          delete this.onEnterFrame;
  1040.       }
  1041.    };
  1042. }
  1043. stop();
  1044.