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

  1. package dss145_11
  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 label_10() : void
  72.       {
  73.          this._engine.hideSwf({"code":"BT_RETOUR"});
  74.       }
  75.       
  76.       public function G2D(value:int) : String
  77.       {
  78.          return GlobalesFunctions.gimme2digits(value);
  79.       }
  80.       
  81.       public function endMODULE() : void
  82.       {
  83.          trace("fin du module");
  84.          this.gListDone[this._engine.config.moduleNum - 1] = 1;
  85.          if(this.gDoneDepart)
  86.          {
  87.             this.so.data.lastDone = 2;
  88.          }
  89.          else
  90.          {
  91.             this.so.data.lastDone = 1;
  92.          }
  93.          this.so.data.listDone = this.gListDone;
  94.          this.so.flush();
  95.          this._engine.host.changeModule({"numMod":0});
  96.       }
  97.       
  98.       public function sleep() : void
  99.       {
  100.          this._pauseManager = new PauseManager(this._engine,this._timelineManager);
  101.          this._pauseManager.sleepMovie(this.mainTimeline);
  102.       }
  103.       
  104.       public function wake() : void
  105.       {
  106.          this._pauseManager.wakeMovie(this.mainTimeline);
  107.       }
  108.       
  109.       public function destroy() : void
  110.       {
  111.          this._engine.stopAllSounds();
  112.          this._timeline_.kilListeners();
  113.       }
  114.    }
  115. }
  116.