home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 141 / MOBICLIC141.ISO / mac / DATA / HOTE / prod_gen / moteur.swf / scripts / frame_1 / DoAction.as
Text File  |  2012-01-10  |  10KB  |  350 lines

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