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