home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 145 / MOBICLIC145.ISO / pc / DATA / DSS145 / DSS145_12 / DSS145_12.swf / scripts / dss145_12 / CapsuleAlgo.as < prev    next >
Text File  |  2012-07-19  |  7KB  |  205 lines

  1. package dss145_12
  2. {
  3.    import com.milanpresse.engine.Engine;
  4.    import com.milanpresse.engine.managers.TimelineManager;
  5.    import com.milanpresse.engine.medias.MediaSwf;
  6.    import com.milanpresse.engine.timelines.TimelineLinear;
  7.    import com.milanpresse.engineaddons.facades.EngineExt;
  8.    import com.milanpresse.engineaddons.initdisplayobject.ExtendedClip;
  9.    import com.milanpresse.tools.GlobalesFunctions;
  10.    import flash.display.MovieClip;
  11.    import flash.events.Event;
  12.    import flash.events.MouseEvent;
  13.    import flash.net.SharedObject;
  14.    
  15.    public class CapsuleAlgo
  16.    {
  17.        
  18.       
  19.       private var _e:EngineExt;
  20.       
  21.       private var mainClip:MediaSwf;
  22.       
  23.       private var mainTimeline:MovieClip;
  24.       
  25.       private var _engine:Engine;
  26.       
  27.       private var _timeline_:TimelineLinear;
  28.       
  29.       private var _timelineManager:TimelineManager;
  30.       
  31.       private var labelsCallback:Object;
  32.       
  33.       private var firstLabel:String;
  34.       
  35.       private var so:SharedObject;
  36.       
  37.       private var gListDone:Array;
  38.       
  39.       private var gListeObjet:Array;
  40.       
  41.       private var gListeCibles:Array;
  42.       
  43.       private var gListeCurrentCibles:Array;
  44.       
  45.       private var gDoneDepart:Boolean;
  46.       
  47.       private var BT_REJOUER2:ExtendedClip;
  48.       
  49.       private var BT_RETOUR:BtRetour;
  50.       
  51.       private var attenteJeu:AttenteJeu = null;
  52.       
  53.       private var isSleeping:Boolean = false;
  54.       
  55.       public function CapsuleAlgo(param1:Engine)
  56.       {
  57.          var engine:Engine = param1;
  58.          this.labelsCallback = {"_11":"prioAnim"};
  59.          super();
  60.          this.initStandardLinear(engine);
  61.          this.firstLabel = this.mainTimeline.currentLabels[0].name;
  62.          this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
  63.          this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
  64.          this.gListDone = this.so.data.listDone;
  65.          this.gDoneDepart = this.gListDone[this._engine.config.moduleNum - 1] == 1;
  66.          this.BT_RETOUR = new BtRetour(this._engine,this._timelineManager,this.so);
  67.          this.BT_RETOUR.setFunctionHideCursorSpecial(function():void
  68.          {
  69.          });
  70.          this.BT_RETOUR.setFunctionShowCursorSpecial(function():void
  71.          {
  72.          });
  73.       }
  74.       
  75.       public function initStandardLinear(param1:Engine) : void
  76.       {
  77.          this._engine = param1;
  78.          this._timelineManager = new TimelineManager();
  79.          this._e = new EngineExt(this._engine,this._timelineManager);
  80.          this._engine.logsTrace();
  81.          this._engine.playMusic({"code":"MU"});
  82.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  83.          this._engine.setFrameRate(12);
  84.          this._engine.levelCZ = this._engine.config.layers["content"];
  85.          this.mainClip = this._engine.showSwf({
  86.             "code":"A_" + this._engine.config.moduleName,
  87.             "parent":this._engine.config.layers["content"]
  88.          });
  89.          this.mainTimeline = this.mainClip.swfContent;
  90.          this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  91.          this.firstLabel = this.mainTimeline.currentLabels[0].name;
  92.       }
  93.       
  94.       public function labelATTENTE_11() : void
  95.       {
  96.          this._e.commentPlay({"code":"11"});
  97.          this.mainTimeline.addEventListener(MouseEvent.CLICK,this.frame_11_Handler);
  98.          this.mainTimeline.mouseEnabled = true;
  99.          this.mainTimeline.buttonMode = true;
  100.          this.mainTimeline.useHandCursor = true;
  101.          this.mainTimeline.enabled = true;
  102.       }
  103.       
  104.       private function frame_11_Handler(param1:Event) : void
  105.       {
  106.          this.mainTimeline.removeEventListener(MouseEvent.CLICK,this.frame_11_Handler);
  107.          this._e.commentStop();
  108.          this.mainTimeline.mouseEnabled = false;
  109.          this.mainTimeline.buttonMode = false;
  110.          this.mainTimeline.useHandCursor = false;
  111.          this.mainTimeline.enabled = false;
  112.          this._timeline_.GotoAndPlayUntil({"labelStop":"_12"});
  113.       }
  114.       
  115.       public function labelATTENTE_JEU() : void
  116.       {
  117.          this.attenteJeu = new AttenteJeu(this._e,this.mainTimeline.GAME_CONTAINER,this.labelATTENTE_JEU_CALLBACK);
  118.          this.attenteJeu.init();
  119.       }
  120.       
  121.       private function labelATTENTE_JEU_CALLBACK() : void
  122.       {
  123.          this.attenteJeu.destroy();
  124.          this.attenteJeu = null;
  125.          this.BT_RETOUR.visible = false;
  126.          this.save();
  127.          this._timeline_.GotoAndPlayUntil({"labelStop":"ATTENTE_SUCCES"});
  128.       }
  129.       
  130.       public function labelATTENTE_SUCCES() : void
  131.       {
  132.          this._e.noisePlay({
  133.             "code":"B_SUCCES",
  134.             "callback":this.labelATTENTE_SUCCES_CALLBACK
  135.          });
  136.       }
  137.       
  138.       public function labelATTENTE_SUCCES_CALLBACK() : void
  139.       {
  140.          this._timeline_.GotoAndPlayUntil({"labelStop":"_14"});
  141.       }
  142.       
  143.       public function G2D(param1:int) : String
  144.       {
  145.          return GlobalesFunctions.gimme2digits(param1);
  146.       }
  147.       
  148.       public function save() : void
  149.       {
  150.          this.BT_RETOUR._gameWon = true;
  151.          this.gListDone[this._engine.config.moduleNum - 1] = 1;
  152.          if(this.gDoneDepart)
  153.          {
  154.             this.so.data.lastDone = 2;
  155.          }
  156.          else
  157.          {
  158.             this.so.data.lastDone = 1;
  159.          }
  160.          this.so.data.listDone = this.gListDone;
  161.          this.so.flush();
  162.       }
  163.       
  164.       public function endMODULE() : void
  165.       {
  166.          this._engine.host.changeModule({"numMod":13});
  167.       }
  168.       
  169.       public function sleep() : void
  170.       {
  171.          if(this.isSleeping)
  172.          {
  173.             return;
  174.          }
  175.          this.isSleeping = true;
  176.          if(this.attenteJeu != null)
  177.          {
  178.             this.attenteJeu.gamePause();
  179.          }
  180.          this._e.movieClipSleep(this.mainTimeline);
  181.       }
  182.       
  183.       public function wake() : void
  184.       {
  185.          if(this.isSleeping == false)
  186.          {
  187.             return;
  188.          }
  189.          this.isSleeping = false;
  190.          if(this.attenteJeu != null)
  191.          {
  192.             this.attenteJeu.gameResume();
  193.          }
  194.          this._e.movieClipWake(this.mainTimeline);
  195.       }
  196.       
  197.       public function destroy() : void
  198.       {
  199.          this.mainTimeline.removeEventListener(MouseEvent.CLICK,this.frame_11_Handler);
  200.          this._timeline_.kilListeners();
  201.          this._e.destroy();
  202.       }
  203.    }
  204. }
  205.