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