home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 145 / MOBICLIC145.ISO / pc / DATA / DSS145 / DSS145_13 / DSS145_13.swf / scripts / dss145_13 / CapsuleAlgo.as
Text File  |  2012-07-19  |  4KB  |  114 lines

  1. package dss145_13
  2. {
  3.    import com.milanpresse.engine.Engine;
  4.    import com.milanpresse.engine.managers.PauseManager;
  5.    import com.milanpresse.engine.managers.TimelineManager;
  6.    import com.milanpresse.engine.medias.MediaSwf;
  7.    import com.milanpresse.engine.timelines.Timeline;
  8.    import com.milanpresse.engine.timelines.TimelineLinear;
  9.    import com.milanpresse.engine.timers.ExtendedTimer;
  10.    import com.milanpresse.tools.GlobalesFunctions;
  11.    import flash.display.MovieClip;
  12.    import flash.events.TimerEvent;
  13.    import flash.net.SharedObject;
  14.    
  15.    public class CapsuleAlgo
  16.    {
  17.        
  18.       
  19.       private var menu:MediaSwf;
  20.       
  21.       private var menuTimeline:MovieClip;
  22.       
  23.       private var menuTL:Timeline;
  24.       
  25.       private var mainClip:MediaSwf;
  26.       
  27.       private var mainTimeline:MovieClip;
  28.       
  29.       private var _engine:Engine;
  30.       
  31.       private var labelList:Array;
  32.       
  33.       private var _timeline_:TimelineLinear;
  34.       
  35.       private var _timelineManager:TimelineManager;
  36.       
  37.       private var _pauseManager:PauseManager;
  38.       
  39.       private var labelsCallback:Object;
  40.       
  41.       private var firstLabel:String;
  42.       
  43.       private var so:SharedObject;
  44.       
  45.       private var gListDone:Array;
  46.       
  47.       private var gDoneDepart:Boolean;
  48.       
  49.       private var timer:ExtendedTimer;
  50.       
  51.       public function CapsuleAlgo(param1:Engine)
  52.       {
  53.          this.labelsCallback = {};
  54.          super();
  55.          this._engine = param1;
  56.          this._engine.playMusic({"code":"MU"});
  57.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  58.          this._engine.setFrameRate(12);
  59.          this.mainClip = this._engine.showSwf({
  60.             "code":"A_" + this._engine.config.moduleName,
  61.             "parent":this._engine.config.layers["content"]
  62.          });
  63.          this.mainTimeline = this.mainClip.swfContent;
  64.          this._timelineManager = new TimelineManager();
  65.          this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  66.          this._engine.levelCZ = this._engine.config.layers["content"];
  67.          this.firstLabel = this.mainTimeline.currentLabels[0].name;
  68.          this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
  69.          this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
  70.          this.gListDone = this.so.data.listDone;
  71.          this.timer = new ExtendedTimer(2000);
  72.       }
  73.       
  74.       public function G2D(param1:int) : String
  75.       {
  76.          return GlobalesFunctions.gimme2digits(param1);
  77.       }
  78.       
  79.       public function endMODULE() : void
  80.       {
  81.          this.timer.addEventListener(TimerEvent.TIMER,this.reallyGo);
  82.          this.timer.start();
  83.       }
  84.       
  85.       public function reallyGo(param1:TimerEvent) : void
  86.       {
  87.          this.timer.removeEventListener(TimerEvent.TIMER,this.reallyGo);
  88.          this._engine.host.changeModule({
  89.             "codeRub":this._engine.host.hostConfig.magSom,
  90.             "numMod":0
  91.          });
  92.       }
  93.       
  94.       public function sleep() : void
  95.       {
  96.          this.timer.pause();
  97.          this._pauseManager = new PauseManager(this._engine,this._timelineManager);
  98.          this._pauseManager.sleepMovie(this.mainTimeline);
  99.       }
  100.       
  101.       public function wake() : void
  102.       {
  103.          this.timer.resume();
  104.          this._pauseManager.wakeMovie(this.mainTimeline);
  105.       }
  106.       
  107.       public function destroy() : void
  108.       {
  109.          this._engine.stopAllSounds();
  110.          this._timeline_.kilListeners();
  111.       }
  112.    }
  113. }
  114.