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