home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 164 / MOBICLIC164.ISO / pc / DATA / HOTE / prod_gen_JLM / moteur.swf / scripts / frame_1 / DoAction.as
Text File  |  2014-05-13  |  15KB  |  512 lines

  1. function gimme2digits(X)
  2. {
  3.    if(Number(X) < 10)
  4.    {
  5.       lX = "0" + Number(X);
  6.    }
  7.    else
  8.    {
  9.       lX = String(X);
  10.    }
  11.    return lX;
  12. }
  13. function gimme3digits(X)
  14. {
  15.    if(Number(X) < 10)
  16.    {
  17.       lX = "00" + Number(X);
  18.    }
  19.    else if(Number(X) < 100)
  20.    {
  21.       lX = "0" + Number(X);
  22.    }
  23.    else
  24.    {
  25.       lX = String(X);
  26.    }
  27.    return lX;
  28. }
  29. function randomValue(min, max)
  30. {
  31.    var _loc1_ = Math.floor(Math.random() * (max - min + 1)) + min;
  32.    return _loc1_;
  33. }
  34. function InitMascotte(p)
  35. {
  36.    trace("InitMascotte " + this);
  37.    var _loc3_ = this.MediasExternes[p.mc._name].ParamsXml;
  38.    var _loc4_ = p.mc;
  39.    _loc4_.ParamsXml = this.MediasExternes[_loc4_._name].ParamsXml;
  40.    trace("this.MediasExternes : " + _root.MediasExternes);
  41.    trace("mascotte._name : " + _loc4_._name);
  42.    trace("this.MediasExternes[mascotte._name].ParamsXml : " + this.MediasExternes[_loc4_._name].ParamsXml);
  43.    trace("this.MediasExternes[mascotte._name] : " + this.MediasExternes[_loc4_._name]);
  44.    _loc4_._x = _loc3_.x != undefined ? _loc3_.x : 0;
  45.    trace("params_xml.x : " + _loc3_.x);
  46.    _loc4_._y = _loc3_.y != undefined ? _loc3_.y : 0;
  47.    trace("params_xml.y : " + _loc3_.y);
  48.    _loc4_._xscale = _loc3_.scale != undefined ? Number(_loc3_.scale) : 100;
  49.    trace("params_xml.scale : " + _loc3_.scale);
  50.    _loc4_._yscale = _loc3_.scale != undefined ? Math.abs(Number(_loc3_.scale)) : 100;
  51.    trace("params_xml.scale : " + _loc3_.scale);
  52.    return _loc4_;
  53. }
  54. function afficherMascottes(mascottes)
  55. {
  56.    _root.AFFICHAGE_MASCOTTES = false;
  57.    if(_root.MascottesMode == "AutoHide")
  58.    {
  59.       var _loc2_ = 0;
  60.       while(_loc2_ < _root.MASCOTTES_LISTE.length)
  61.       {
  62.          _root.MASCOTTES_LISTE[_loc2_]._visible = false;
  63.          _root.MASCOTTES_LISTE[_loc2_].ETAT = "E2";
  64.          _loc2_ = _loc2_ + 1;
  65.       }
  66.    }
  67.    if(mascottes != undefined)
  68.    {
  69.       _root.AFFICHAGE_MASCOTTES = true;
  70.       var _loc4_ = undefined;
  71.       _loc2_ = 0;
  72.       while(_loc2_ < mascottes.length)
  73.       {
  74.          _loc4_ = _root["MASC_" + mascottes[_loc2_].nom];
  75.          _loc4_.ETAT = mascottes[_loc2_].action;
  76.          trace("mascottes[i].action : " + mascottes[_loc2_].action);
  77.          _loc4_.gotoAndStop(mascottes[_loc2_].action);
  78.          _root.InitMascotte({mc:_loc4_});
  79.          _loc4_._visible = true;
  80.          _loc2_ = _loc2_ + 1;
  81.       }
  82.    }
  83. }
  84. function cacherMascottes()
  85. {
  86.    var _loc2_ = 0;
  87.    while(_loc2_ < _root.MASCOTTES_LISTE.length)
  88.    {
  89.       _root.MASCOTTES_LISTE[_loc2_]._visible = false;
  90.       _root.MASCOTTES_LISTE[_loc2_].ETAT = "E2";
  91.       _loc2_ = _loc2_ + 1;
  92.    }
  93. }
  94. function testeDebutCommentSpecial()
  95. {
  96.    var _loc2_ = _root.gCommentOn.id.split("_")[_root.gCommentOn.id.split("_").length - 1];
  97.    switch(_loc2_)
  98.    {
  99.       case "bz":
  100.       case "BZ":
  101.          trace("-------  BZ on-----------");
  102.          _root.DesactiveOEIL();
  103.          if(_root.BT_OEIL.gEtat !== 3)
  104.          {
  105.             trace("E3");
  106.             _root.BT_OEIL.gotoAndPlay("E3");
  107.          }
  108.          else
  109.          {
  110.             trace("PARLE");
  111.             _root.BT_OEIL.OEIL_P.gotoAndPlay("parle");
  112.          }
  113.          break;
  114.       case "ze":
  115.       case "ZE":
  116.          trace("-------  ZE on-----------");
  117.          _root.DesactiveOEIL();
  118.          if(_root.BT_OEIL.gEtat !== 3)
  119.          {
  120.             _root.BT_OEIL.gotoAndPlay("E3");
  121.          }
  122.          else
  123.          {
  124.             _root.BT_OEIL.OEIL_P.gotoAndPlay("parle");
  125.          }
  126.          _root.afficherRolls();
  127.          break;
  128.       case "sp":
  129.       case "SP":
  130.          trace("-------  SP on-----------");
  131.          _root.MASCOTTE_SPAM.gotoAndStop("E1");
  132.          _root.MASCOTTE_SPAM._visible = true;
  133.          break;
  134.       case "wk":
  135.       case "WK":
  136.          trace("-------  WK on-----------");
  137.          trace("-------  MASCOTTE_WIKI-----------");
  138.          _root.MASCOTTE_WIKI.gotoAndStop("E1");
  139.          _root.MASCOTTE_WIKI._visible = true;
  140.          break;
  141.       case "bg":
  142.       case "BG":
  143.          trace("-------  BG on-----------");
  144.          _root.MASCOTTE_BUG.gotoAndStop("E1");
  145.          _root.MASCOTTE_BUG._visible = true;
  146.    }
  147. }
  148. function testeFinCommentSpecial()
  149. {
  150.    var _loc2_ = _root.gCommentOn.id.split("_")[_root.gCommentOn.id.split("_").length - 1];
  151.    switch(_loc2_)
  152.    {
  153.       case "bz":
  154.       case "BZ":
  155.          trace("-------  BZ off-----------");
  156.          _root.ActiveOEIL();
  157.          _root.BT_OEIL.OEIL_P.gotoAndPlay("rentre");
  158.          _root.BT_OEIL.gClicOn = undefined;
  159.          break;
  160.       case "ze":
  161.       case "ZE":
  162.          trace("-------  ZE off-----------");
  163.          _root.ActiveOEIL();
  164.          _root.BT_OEIL.OEIL_P.gotoAndPlay("rentre");
  165.          _root.BT_OEIL.gClicOn = undefined;
  166.          _root.masquerRolls();
  167.          break;
  168.       case "sp":
  169.       case "SP":
  170.          trace("-------  SP off-----------");
  171.          _root.MASCOTTE_SPAM.gotoAndStop("E2");
  172.          if(_root.MASCOTTE_SPAM.CacherApres != false)
  173.          {
  174.             _root.MASCOTTE_SPAM._visible = false;
  175.          }
  176.          break;
  177.       case "wk":
  178.       case "WK":
  179.          trace("-------  WK off-----------");
  180.          _root.MASCOTTE_WIKI.gotoAndStop("E2");
  181.          if(_root.MASCOTTE_WIKI.CacherApres != false)
  182.          {
  183.             _root.MASCOTTE_WIKI._visible = false;
  184.          }
  185.          break;
  186.       case "bg":
  187.       case "BG":
  188.          trace("-------  BG off-----------");
  189.          _root.MASCOTTE_BUG.gotoAndStop("E2");
  190.          if(_root.MASCOTTE_BUG.CacherApres != false)
  191.          {
  192.             _root.MASCOTTE_BUG._visible = false;
  193.          }
  194.    }
  195. }
  196. function activePause(lClip)
  197. {
  198.    trace("pause generale du clip " + lClip);
  199.    activePauseClips(lClip);
  200.    activePauseSons(lClip);
  201.    activePauseInterval(lClip);
  202. }
  203. function activePauseSons(lClip)
  204. {
  205.    trace("active pause sons");
  206.    if(lClip.gCommentOn !== undefined)
  207.    {
  208.       lClip.gCommentOnPause = lClip.gCommentOn;
  209.       lClip.gCommentOnPause.p = lClip.gCommentOn.p;
  210.       lClip.gCommentOnPausePos = lClip.gCommentOn.position;
  211.       stopComment();
  212.    }
  213.    if(lClip.gListeBruitage !== undefined)
  214.    {
  215.       lClip.gListeBruitageP = new Object();
  216.       i = lClip.gListeBruitage.length - 1;
  217.       while(i >= 0)
  218.       {
  219.          var _loc2_ = lClip.soundObjects[lClip.gBruitageName + lClip.gListeBruitage[i]];
  220.          _loc2_.p.offset = _loc2_.position / 1000;
  221.          lClip.gListeBruitageP["Bruit_" + i] = _loc2_.p;
  222.          stopBruit(_loc2_.p);
  223.          i--;
  224.       }
  225.    }
  226. }
  227. function desactivePause(lClip)
  228. {
  229.    desactivePauseClips(lClip);
  230.    desactivePauseSons(lClip);
  231.    desactivePauseInterval(lClip);
  232. }
  233. function desactivePauseSons(lClip)
  234. {
  235.    if(lClip.gCommentOnPausePos !== undefined)
  236.    {
  237.       if(lClip.gCommentOnPause.duration / 1000 !== lClip.gCommentOnPausePos / 1000)
  238.       {
  239.          joueSon(lClip.gCommentOnPause.p);
  240.       }
  241.    }
  242.    if(lClip.gListeBruitageP !== undefined)
  243.    {
  244.       for(var _loc2_ in lClip.gListeBruitageP)
  245.       {
  246.          joueBruitage(lClip.gListeBruitageP[_loc2_]);
  247.       }
  248.       lClip.gListeBruitageP = undefined;
  249.       lClip.gListePosBruitage = undefined;
  250.    }
  251. }
  252. function pauseClipRecursive(mc, lClip)
  253. {
  254.    for(var _loc5_ in lClip)
  255.    {
  256.       if(typeof lClip[_loc5_] == "movieclip")
  257.       {
  258.          if(_root.getPos(mc.gListeClips,lClip[_loc5_]) == -1)
  259.          {
  260.             mc.gListeClips.push(lClip[_loc5_]);
  261.             mc.gListeClipFrame.push(lClip[_loc5_]._currentframe);
  262.             var _loc4_ = mc.gListeClips[mc.gListeClips.length - 1];
  263.             pauseClipRecursive(mc,_loc4_);
  264.          }
  265.       }
  266.    }
  267. }
  268. function activePauseClips(pClip)
  269. {
  270.    pClip.createEmptyMovieClip("testPause",chercheDepthPlus(pClip,300));
  271.    trace("testPause = " + pClip.testPause);
  272.    var _loc3_ = pClip.testPause;
  273.    _loc3_.gListeClips = [];
  274.    _loc3_.gListeClipFrame = [];
  275.    _loc3_.gListeClipsPlayStop = [];
  276.    _loc3_.gListeClipEnterFrame = [];
  277.    _loc3_.pFrame = 0;
  278.    _loc3_.onEnterFrame = function()
  279.    {
  280.       this.pFrame += 1;
  281.       if(this.pFrame == 1)
  282.       {
  283.          this.gListeClips.push(pClip);
  284.          this.gListeClipFrame.push(pClip._currentframe);
  285.          pauseClipRecursive(this,pClip);
  286.       }
  287.       else
  288.       {
  289.          var _loc2_ = 0;
  290.          while(_loc2_ < this.gListeClips.length)
  291.          {
  292.             if(this.gListeClips[_loc2_]._currentframe !== this.gListeClipFrame[_loc2_])
  293.             {
  294.                this.gListeClipsPlayStop[_loc2_] = 1;
  295.             }
  296.             else
  297.             {
  298.                this.gListeClipsPlayStop[_loc2_] = 0;
  299.             }
  300.             this.gListeClips[_loc2_].gotoAndStop(this.gListeClipFrame[_loc2_]);
  301.             _loc2_ = _loc2_ + 1;
  302.          }
  303.          delete this.onEnterFrame;
  304.       }
  305.    };
  306. }
  307. function desactivePauseClips(pClip)
  308. {
  309.    var _loc2_ = pClip.testPause;
  310.    var _loc1_ = 0;
  311.    while(_loc1_ < _loc2_.gListeClips.length)
  312.    {
  313.       if(_loc2_.gListeClipsPlayStop[_loc1_] == 1)
  314.       {
  315.          _loc2_.gListeClips[_loc1_].gotoAndPlay(_loc2_.gListeClipFrame[_loc1_]);
  316.       }
  317.       else
  318.       {
  319.          _loc2_.gListeClips[_loc1_].gotoAndStop(_loc2_.gListeClipFrame[_loc1_]);
  320.       }
  321.       _loc1_ = _loc1_ + 1;
  322.    }
  323.    removeMovieClip(_loc2_);
  324. }
  325. this.CIBLE = _root;
  326. _global.gimme2digits = gimme2digits;
  327. _global.gimme3digits = gimme3digits;
  328. _global.randomValue = randomValue;
  329. _root.InitMascotte = InitMascotte;
  330. _root.afficherMascottes = afficherMascottes;
  331. _root.MascottesMode = "AutoHide";
  332. _root.cacherMascottes = cacherMascottes;
  333. var CIBLE = _root;
  334. this.xPauseOn = function()
  335. {
  336.    trace("xPauseOn " + this + " " + _global.pauseComment);
  337.    _global.pauseComment();
  338.    this.moteur.PauseMCs = [];
  339.    this.moteur.xPause_rec({clipref:_root});
  340. };
  341. this.xPauseOff = function()
  342. {
  343.    trace("xPauseOff " + this);
  344.    this.moteur.PauseDesactive();
  345.    _global.continueComment();
  346. };
  347. this.PAUSEINTFUNC = function()
  348. {
  349.    var _loc3_ = getTimer();
  350.    if(_loc3_ - this.firstTime >= 100)
  351.    {
  352.       clearInterval(this.PAUSEINT);
  353.       this.xPause_rec2({clipref:_root});
  354.    }
  355. };
  356. this.xPause_rec = function(p)
  357. {
  358.    for(prop in p.clipref)
  359.    {
  360.       if(typeof p.clipref[prop] == "movieclip" && p.clipref[prop] != _root && p.clipref[prop].NoPause != true)
  361.       {
  362.          p.clipref[prop].DetectFrameFirst = p.clipref[prop]._currentframe;
  363.          this.xPause_rec({clipref:p.clipref[prop]});
  364.       }
  365.    }
  366.    if(p.clipref == _root)
  367.    {
  368.       this.firstTime = getTimer();
  369.       this.PAUSEINT = setInterval(this,"PAUSEINTFUNC",10);
  370.    }
  371. };
  372. this.xPause_rec2 = function(p)
  373. {
  374.    for(prop in p.clipref)
  375.    {
  376.       if(typeof p.clipref[prop] == "movieclip" && p.clipref[prop] != _root && p.clipref[prop].NoPause != true)
  377.       {
  378.          p.clipref[prop].DetectFrameLast = p.clipref[prop]._currentframe;
  379.          if(p.clipref[prop].DetectFrameLast != p.clipref[prop].DetectFrameFirst)
  380.          {
  381.             this.PauseMCs.push(p.clipref[prop]);
  382.          }
  383.          this.xPause_rec2({clipref:p.clipref[prop]});
  384.       }
  385.    }
  386.    if(p.clipref == _root)
  387.    {
  388.       this.PauseActive();
  389.    }
  390. };
  391. this.CIBLE = _root;
  392. if(_global.gDataPath == undefined)
  393. {
  394.    _global.gDataPath = "../../";
  395. }
  396. this.ChargeMoteur = function(p)
  397. {
  398.    _root.moduleXmlRoot = _global.moduleXmlRoot;
  399.    trace("_ChargeMoteur() - Chargement du moteur (prod/moteur/main.as)" + _root);
  400.    _root.gModulePath = GetFilePath(this.CIBLE._url) + "/";
  401.    trace("_root.gModulePath : " + _root.gModulePath);
  402.    if(!_root.moduleOnline)
  403.    {
  404.       _root.XmlStocker = new XML();
  405.       _root.XmlStocker.ignoreWhite = true;
  406.       _root.XmlStocker.load(_root.gModulePath + "localConfig.xml");
  407.       _root.XmlStocker.onLoad = _root.onlocalConfigLoaded;
  408.    }
  409.    else
  410.    {
  411.       _root.Main();
  412.    }
  413. };
  414. _root.ChargeMoteur = this.ChargeMoteur;
  415. this.CIBLE.onlocalConfigLoaded = function(success)
  416. {
  417.    trace("xml.onlocalConfigLoaded ");
  418.    if(success)
  419.    {
  420.       _root.moduleXmlRoot = _root.gModulePath + this.firstChild.attributes.src;
  421.       _root.Main();
  422.    }
  423. };
  424. this.CIBLE.Main = function()
  425. {
  426.    this.CIBLE.moduleInfo = _root.moduleInfo = new prod.moteur.V001_ChargementXML(this.CIBLE,_root.moduleXmlRoot,_root.moduleOnline);
  427. };
  428. this.CIBLE.xmlLoaded = function()
  429. {
  430.    trace("(!) xmlLoaded() ");
  431.    _global.HOTE.LoadingProgress(70);
  432.    this.initGen();
  433.    this.gModuleName = this.moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.id;
  434.    this.gCommentName = "S_" + this.gLangue + "_" + this.gModuleName + "_";
  435.    this.gBruitageName = "B_" + this.gModuleName + "_";
  436.    this.gImagesPath = this.gModulePath + "/I_" + this.gModuleName;
  437.    var _loc3_ = this.gModuleName.split("_");
  438.    this.gModuleNumber = Number(_loc3_[_loc3_.length - 1]);
  439.    this.gRubriqueName = _loc3_[0].substr(0,3);
  440.    this.gCdName = _loc3_[0].substr(3,3);
  441.    this.traceModuleInfos();
  442.    this.mediaChargeur = new prod.moteur.V007xb_ChargementMedias(this.CIBLE,this.CIBLE.moduleInfo,this.CIBLE.moduleOnline);
  443.    this.gereTextes = new prod.moteur.V014_GereTextes(this.CIBLE,this.CIBLE.moduleInfo);
  444. };
  445. this.CIBLE.mediaLoaded = function()
  446. {
  447.    if(typeof this.mediaChargeur == "undefined")
  448.    {
  449.       this.OnlySoundExterneHack = setInterval(this,"mediaLoaded",20);
  450.    }
  451.    else
  452.    {
  453.       trace("__mediaLoaded()");
  454.       this.soundObjects = this.mediaChargeur.returnSoundObject();
  455.       clearInterval(this.OnlySoundExterneHack);
  456.       this.initModule();
  457.    }
  458. };
  459. this.CIBLE.initModule = function()
  460. {
  461.    trace("__initModule()" + this.CIBLE + " _ " + this.CIBLE.initVariables);
  462.    _global.HOTE.LoadingProgress(90);
  463.    this.CIBLE.initVariables();
  464. };
  465. _root.initKeyPause = function()
  466. {
  467.    gPauseOn = 0;
  468.    gPauseSpaceOn = 0;
  469.    gPauseSpaceEnCours = 0;
  470. };
  471. _root.initGen = function()
  472. {
  473.    trace("(!) initGen (HOTE/prod_gen??/prod/moteur/main.as)");
  474.    _root.gClipGen = _global.gClipGen = this;
  475.    this.gLangue = _global.HOTE.LocalConfig.Langue != undefined ? _global.HOTE.LocalConfig.Langue.toUpperCase() : "FR";
  476.    this.gMusicOn = 1;
  477.    this.gSousTitre = 0;
  478.    this.gST = 0;
  479.    this.gVolume = 100;
  480.    this.gWidth = moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.width;
  481.    this.gHeight = moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.height;
  482.    if(this.gWidth == undefined)
  483.    {
  484.       this.gWidth = 800;
  485.    }
  486.    else
  487.    {
  488.       this.gWidth = Number(this.gWidth);
  489.    }
  490.    if(this.gHeight == undefined)
  491.    {
  492.       this.gHeight = 600;
  493.    }
  494.    else
  495.    {
  496.       this.gHeight = Number(this.gHeight);
  497.    }
  498.    initKeyPause();
  499. };
  500. _root.traceModuleInfos = function()
  501. {
  502.    trace("");
  503.    trace("(!)_________ traceModuleInfos _________");
  504.    trace("gLangue : " + this.gLangue);
  505.    trace("gCdName : " + this.gCdName);
  506.    trace("gRubriqueName : " + this.gRubriqueName);
  507.    trace("gModuleNumber : " + this.gModuleNumber);
  508.    trace("(!)____________________________________");
  509.    trace("");
  510. };
  511. stop();
  512.