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