home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 145 / MOBICLIC145.ISO / pc / DATA / DSS145 / DSS145_01 / DSS145_01.swf / scripts / dss145_01 / CapsuleAlgo.as < prev   
Text File  |  2012-07-18  |  4KB  |  114 lines

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