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