home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 164 / MOBICLIC164.ISO / mac / DATA / HOTE / prod_gen_ED / moteur.swf / scripts / frame_1 / DoAction.as
Text File  |  2014-05-13  |  10KB  |  344 lines

  1. function activePause(lClip)
  2. {
  3.    if(lClip.streamVideoPlaying !== undefined)
  4.    {
  5.       lClip.streamVideoPlaying.pause();
  6.    }
  7.    trace("pause generale du clip " + lClip);
  8.    activePauseClips(lClip);
  9.    activePauseSons(lClip);
  10.    activePauseInterval(lClip);
  11. }
  12. function activePauseSons(lClip)
  13. {
  14.    trace("active pause sons");
  15.    if(lClip.gCommentOn !== undefined)
  16.    {
  17.       lClip.gCommentOnPause = lClip.gCommentOn;
  18.       lClip.gCommentOnPause.p = lClip.gCommentOn.p;
  19.       lClip.gCommentOnPausePos = lClip.gCommentOn.position;
  20.       stopComment();
  21.    }
  22.    if(lClip.gListeBruitage !== undefined)
  23.    {
  24.       lClip.gListeBruitageP = new Object();
  25.       i = lClip.gListeBruitage.length - 1;
  26.       while(i >= 0)
  27.       {
  28.          var _loc1_ = lClip.soundObjects[lClip.gBruitageName + lClip.gListeBruitage[i]];
  29.          _loc1_.p.offset = _loc1_.position / 1000;
  30.          _loc1_.p.media = _loc1_;
  31.          lClip.gListeBruitageP["Bruit_" + i] = _loc1_.p;
  32.          stopBruit(_loc1_.p);
  33.          i--;
  34.       }
  35.    }
  36. }
  37. function desactivePause(lClip)
  38. {
  39.    desactivePauseClips(lClip);
  40.    desactivePauseSons(lClip);
  41.    desactivePauseInterval(lClip);
  42.    if(lClip.streamVideoPlaying !== undefined)
  43.    {
  44.       lClip.streamVideoPlaying.pause();
  45.    }
  46. }
  47. function desactivePauseSons(lClip)
  48. {
  49.    if(lClip.gCommentOnPausePos !== undefined)
  50.    {
  51.       if(lClip.gCommentOnPause.duration / 1000 !== lClip.gCommentOnPausePos / 1000)
  52.       {
  53.          joueSon(lClip.gCommentOnPause.p);
  54.       }
  55.       else
  56.       {
  57.          lClip.commentFini();
  58.       }
  59.    }
  60.    if(lClip.gListeBruitageP !== undefined)
  61.    {
  62.       for(var _loc2_ in lClip.gListeBruitageP)
  63.       {
  64.          if(lClip.gListeBruitageP[_loc2_].duration / 1000 !== lClip.gListeBruitageP[_loc2_].offset)
  65.          {
  66.             joueBruitage(lClip.gListeBruitageP[_loc2_]);
  67.          }
  68.          else if(lClip.gListeBruitageP[_loc2_].actionFin !== undefined)
  69.          {
  70.             lClip[lClip.gListeBruitageP[_loc2_].actionFin]();
  71.          }
  72.       }
  73.       lClip.gListeBruitageP = undefined;
  74.       lClip.gListePosBruitage = undefined;
  75.    }
  76. }
  77. function pauseClipRecursive(mc, lClip)
  78. {
  79.    for(var _loc5_ in lClip)
  80.    {
  81.       if(typeof lClip[_loc5_] == "movieclip")
  82.       {
  83.          if(_root.getPos(mc.gListeClips,lClip[_loc5_]) == -1)
  84.          {
  85.             mc.gListeClips.push(lClip[_loc5_]);
  86.             mc.gListeClipFrame.push(lClip[_loc5_]._currentframe);
  87.             var _loc4_ = mc.gListeClips[mc.gListeClips.length - 1];
  88.             pauseClipRecursive(mc,_loc4_);
  89.          }
  90.       }
  91.    }
  92. }
  93. function activePauseClips(pClip)
  94. {
  95.    pClip.createEmptyMovieClip("testPause",chercheDepthPlus(pClip,300));
  96.    trace("testPause = " + pClip.testPause);
  97.    var _loc3_ = pClip.testPause;
  98.    _loc3_.gListeClips = [];
  99.    _loc3_.gListeClipFrame = [];
  100.    _loc3_.gListeClipsPlayStop = [];
  101.    _loc3_.gListeClipEnterFrame = [];
  102.    _loc3_.pFrame = 0;
  103.    _loc3_.onEnterFrame = function()
  104.    {
  105.       this.pFrame += 1;
  106.       if(this.pFrame == 1)
  107.       {
  108.          this.gListeClips.push(pClip);
  109.          this.gListeClipFrame.push(pClip._currentframe);
  110.          pauseClipRecursive(this,pClip);
  111.       }
  112.       else
  113.       {
  114.          var _loc2_ = 0;
  115.          while(_loc2_ < this.gListeClips.length)
  116.          {
  117.             if(this.gListeClips[_loc2_]._currentframe !== this.gListeClipFrame[_loc2_])
  118.             {
  119.                this.gListeClipsPlayStop[_loc2_] = 1;
  120.             }
  121.             else
  122.             {
  123.                this.gListeClipsPlayStop[_loc2_] = 0;
  124.             }
  125.             this.gListeClips[_loc2_].gotoAndStop(this.gListeClipFrame[_loc2_]);
  126.             _loc2_ = _loc2_ + 1;
  127.          }
  128.          delete this.onEnterFrame;
  129.       }
  130.    };
  131. }
  132. function desactivePauseClips(pClip)
  133. {
  134.    var _loc2_ = pClip.testPause;
  135.    var _loc1_ = 0;
  136.    while(_loc1_ < _loc2_.gListeClips.length)
  137.    {
  138.       if(_loc2_.gListeClipsPlayStop[_loc1_] == 1)
  139.       {
  140.          _loc2_.gListeClips[_loc1_].gotoAndPlay(_loc2_.gListeClipFrame[_loc1_]);
  141.       }
  142.       else
  143.       {
  144.          _loc2_.gListeClips[_loc1_].gotoAndStop(_loc2_.gListeClipFrame[_loc1_]);
  145.       }
  146.       _loc1_ = _loc1_ + 1;
  147.    }
  148.    removeMovieClip(_loc2_);
  149. }
  150. this.CIBLE = _root;
  151. this.xPauseOn = function()
  152. {
  153.    trace("xPauseOn " + this + " " + _global.pauseComment);
  154.    _global.pauseComment();
  155.    this.moteur.PauseMCs = [];
  156.    this.moteur.xPause_rec({clipref:_root});
  157. };
  158. this.xPauseOff = function()
  159. {
  160.    trace("xPauseOff " + this);
  161.    this.moteur.PauseDesactive();
  162.    _global.continueComment();
  163. };
  164. this.PAUSEINTFUNC = function()
  165. {
  166.    var _loc3_ = getTimer();
  167.    if(_loc3_ - this.firstTime >= 100)
  168.    {
  169.       clearInterval(this.PAUSEINT);
  170.       this.xPause_rec2({clipref:_root});
  171.    }
  172. };
  173. this.xPause_rec = function(p)
  174. {
  175.    for(prop in p.clipref)
  176.    {
  177.       if(typeof p.clipref[prop] == "movieclip" && p.clipref[prop] != _root && p.clipref[prop].NoPause != true)
  178.       {
  179.          p.clipref[prop].DetectFrameFirst = p.clipref[prop]._currentframe;
  180.          this.xPause_rec({clipref:p.clipref[prop]});
  181.       }
  182.    }
  183.    if(p.clipref == _root)
  184.    {
  185.       this.firstTime = getTimer();
  186.       this.PAUSEINT = setInterval(this,"PAUSEINTFUNC",10);
  187.    }
  188. };
  189. this.xPause_rec2 = function(p)
  190. {
  191.    for(prop in p.clipref)
  192.    {
  193.       if(typeof p.clipref[prop] == "movieclip" && p.clipref[prop] != _root && p.clipref[prop].NoPause != true)
  194.       {
  195.          p.clipref[prop].DetectFrameLast = p.clipref[prop]._currentframe;
  196.          if(p.clipref[prop].DetectFrameLast != p.clipref[prop].DetectFrameFirst)
  197.          {
  198.             this.PauseMCs.push(p.clipref[prop]);
  199.          }
  200.          this.xPause_rec2({clipref:p.clipref[prop]});
  201.       }
  202.    }
  203.    if(p.clipref == _root)
  204.    {
  205.       this.PauseActive();
  206.    }
  207. };
  208. this.PauseActive = function()
  209. {
  210.    trace("PAUSEACTIVE " + this.PauseMCs.length);
  211.    for(prop in this.PauseMCs)
  212.    {
  213.       trace(this.PauseMCs[prop]);
  214.       this.PauseMCs[prop].stop();
  215.    }
  216. };
  217. this.PauseDesactive = function()
  218. {
  219.    trace("PAUSEDESACTIVE " + this.PauseMCs.length);
  220.    for(prop in this.PauseMCs)
  221.    {
  222.       trace(this.PauseMCs[prop]);
  223.       this.PauseMCs[prop].play();
  224.    }
  225. };
  226. this.CIBLE = _root;
  227. if(_global.gDataPath == undefined)
  228. {
  229.    _global.gDataPath = "../../";
  230. }
  231. this.ChargeMoteur = function(p)
  232. {
  233.    _root.moduleXmlRoot = _global.moduleXmlRoot;
  234.    trace("_ChargeMoteur() - Chargement du moteur (prod/moteur/main.as)" + _root);
  235.    if(_global.gModulePath == undefined)
  236.    {
  237.       _root.gModulePath = _global.gModulePath = "";
  238.    }
  239.    else
  240.    {
  241.       _root.gModulePath = _global.gModulePath;
  242.    }
  243.    if(!_root.moduleOnline)
  244.    {
  245.       _root.XmlStocker = new XML();
  246.       _root.XmlStocker.ignoreWhite = true;
  247.       _root.XmlStocker.load(_root.gModulePath + "localConfig.xml");
  248.       _root.XmlStocker.onLoad = _root.onlocalConfigLoaded;
  249.    }
  250.    else
  251.    {
  252.       _root.Main();
  253.    }
  254. };
  255. _root.ChargeMoteur = this.ChargeMoteur;
  256. this.CIBLE.onlocalConfigLoaded = function(success)
  257. {
  258.    trace("onlocalConfigLoaded " + this);
  259.    if(success)
  260.    {
  261.       _root.moduleXmlRoot = _root.gModulePath + this.firstChild.attributes.src;
  262.       _root.Main();
  263.    }
  264. };
  265. this.CIBLE.Main = function()
  266. {
  267.    trace(this.CIBLE);
  268.    this.CIBLE.moduleInfo = _root.moduleInfo = new prod.moteur.V000_ChargementXML(this.CIBLE,_root.moduleXmlRoot,_root.moduleOnline);
  269. };
  270. this.CIBLE.xmlLoaded = function()
  271. {
  272.    trace("__xmlLoaded() " + this.CIBLE);
  273.    _global.HOTE.LoadingProgress(70);
  274.    this.initGen();
  275.    this.gModuleName = this.moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.id;
  276.    this.gCommentName = "S_" + this.gLangue + "_" + this.gModuleName + "_";
  277.    this.gBruitageName = "B_" + this.gModuleName + "_";
  278.    this.gImagesPath = this.gModulePath + "/I_" + this.gModuleName;
  279.    var _loc3_ = this.gModuleName.split("_");
  280.    this.gModuleNumber = Number(_loc3_[_loc3_.length - 1]);
  281.    this.mediaChargeur = new prod.moteur.V007_ED_ChargementMedias(this.CIBLE,this.CIBLE.moduleInfo,this.CIBLE.moduleOnline);
  282.    this.gereTextes = new prod.moteur.V020_GereTextes(this.CIBLE,this.CIBLE.moduleInfo);
  283. };
  284. this.CIBLE.mediaLoaded = function()
  285. {
  286.    trace("mediaLoaded =");
  287.    if(typeof this.mediaChargeur == "undefined")
  288.    {
  289.       this.OnlySoundExterneHack = setInterval(this,"mediaLoaded",20);
  290.    }
  291.    else
  292.    {
  293.       trace("__mediaLoaded()");
  294.       this.soundObjects = this.mediaChargeur.returnSoundObject();
  295.       clearInterval(this.OnlySoundExterneHack);
  296.       this.initModule();
  297.    }
  298. };
  299. this.CIBLE.initModule = function()
  300. {
  301.    trace("__initModule()" + this.CIBLE + " _ " + this.CIBLE.initVariables);
  302.    _global.HOTE.LoadingProgress(90);
  303.    this.CIBLE.initVariables();
  304.    this.CIBLE.gDoneChargement = 1;
  305. };
  306. _root.initKeyPause = function()
  307. {
  308.    gPauseOn = 0;
  309.    gPauseSpaceOn = 0;
  310.    gPauseSpaceEnCours = 0;
  311. };
  312. _root.initGen = function()
  313. {
  314.    _root.gClipGen = _global.gClipGen = this;
  315.    trace("______________________________ " + this);
  316.    trace("AFTER _____________ Stage.showMenu _________________ ");
  317.    this.gLangue = _global.HOTE.LocalConfig.Langue != undefined ? _global.HOTE.LocalConfig.Langue.toUpperCase() : "FR";
  318.    this.gMusicOn = 1;
  319.    this.gSousTitre = 0;
  320.    this.gST = 0;
  321.    this.gVolume = 100;
  322.    this.gWidth = moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.width;
  323.    this.gHeight = moduleInfo.returnNodeByPath("BackOffice").firstChild.attributes.height;
  324.    if(this.gWidth == undefined)
  325.    {
  326.       this.gWidth = 800;
  327.    }
  328.    else
  329.    {
  330.       this.gWidth = Number(this.gWidth);
  331.    }
  332.    if(this.gHeight == undefined)
  333.    {
  334.       this.gHeight = 600;
  335.    }
  336.    else
  337.    {
  338.       this.gHeight = Number(this.gHeight);
  339.    }
  340.    initKeyPause();
  341. };
  342. trace("zzzz " + _root + " " + this.CIBLE);
  343. stop();
  344.