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