home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 145 / MOBICLIC145.ISO / pc / DATA / BLA145 / BLA145_02 / BLA145_00.swf / scripts / bla145_02 / CapsuleAlgo.as
Text File  |  2012-07-18  |  5KB  |  143 lines

  1. package bla145_02
  2. {
  3.    import com.milanpresse.engine.Engine;
  4.    import com.milanpresse.engine.initmovieclip.InteractiveMovie;
  5.    import com.milanpresse.engine.managers.PauseManager;
  6.    import com.milanpresse.engine.managers.TimelineManager;
  7.    import com.milanpresse.engine.medias.MediaSwf;
  8.    import com.milanpresse.engine.timelines.Timeline;
  9.    import com.milanpresse.tools.GlobalesFunctions;
  10.    import flash.display.MovieClip;
  11.    
  12.    public class CapsuleAlgo
  13.    {
  14.        
  15.       
  16.       private var menu:MediaSwf;
  17.       
  18.       private var menuTimeline:MovieClip;
  19.       
  20.       private var menuTL:Timeline;
  21.       
  22.       private var mainClip:MediaSwf;
  23.       
  24.       private var mainTimeline:MovieClip;
  25.       
  26.       private var _engine:Engine;
  27.       
  28.       private var labelList:Array;
  29.       
  30.       private var _timeline_:Timeline;
  31.       
  32.       private var _timelineManager:TimelineManager;
  33.       
  34.       private var _pauseManager:PauseManager;
  35.       
  36.       private var firstLabel:String = "_01";
  37.       
  38.       private var gSon:int = 1;
  39.       
  40.       private var gNbSon:int = 4;
  41.       
  42.       private var gOutilBLA:int = 3;
  43.       
  44.       public function CapsuleAlgo(engine:Engine)
  45.       {
  46.          super();
  47.          this._engine = engine;
  48.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  49.          this._engine.setFrameRate(12);
  50.          this.mainClip = this._engine.showSwf({
  51.             "code":"A_" + this._engine.config.moduleName,
  52.             "parent":this._engine.config.layers["content"]
  53.          });
  54.          this.mainTimeline = this.mainClip.swfContent;
  55.          this._timelineManager = new TimelineManager();
  56.          this._timeline_ = new Timeline(this.mainTimeline,this._timelineManager);
  57.          this._engine.levelCZ = this._engine.config.layers["content"];
  58.          this._timeline_.GotoAndPlayUntil({
  59.             "labelPlay":1,
  60.             "labelStop":this.firstLabel,
  61.             "callback":this.afficheST
  62.          });
  63.       }
  64.       
  65.       public function afficheST() : void
  66.       {
  67.          this._engine.config.subtitlesBloc.showByCommentID(this._engine.config.commentName + this.mainTimeline.currentFrameLabel.substr(1,2));
  68.          this._timeline_.GotoAndPlayUntil({
  69.             "labelPlay":this.mainTimeline.currentFrame + 1,
  70.             "labelStop":this.mainTimeline.currentFrameLabel + "fin",
  71.             "callback":this.masqueST
  72.          });
  73.          this.gSon += 1;
  74.       }
  75.       
  76.       public function masqueST() : void
  77.       {
  78.          this._engine.config.subtitlesBloc.hide();
  79.          var pNextLabel:int = this.getNextLabel();
  80.          if(pNextLabel == -1)
  81.          {
  82.             this._timeline_.GotoAndPlayUntilTheEnd(this.mainTimeline.currentFrame + 1,this.endMODULE);
  83.          }
  84.          else
  85.          {
  86.             this._timeline_.GotoAndPlayUntil({
  87.                "labelPlay":this.mainTimeline.currentFrame + 1,
  88.                "labelStop":pNextLabel,
  89.                "callback":this.afficheST
  90.             });
  91.          }
  92.       }
  93.       
  94.       public function getNextLabel() : int
  95.       {
  96.          var pos:int = this._timeline_.getPosFrameLabelByName(this.mainTimeline,this.mainTimeline.currentLabel);
  97.          if(pos < this.mainTimeline.currentLabels.length - 1)
  98.          {
  99.             return this.mainTimeline.currentLabels[pos + 1].frame;
  100.          }
  101.          return -1;
  102.       }
  103.       
  104.       public function labelATTENTE() : void
  105.       {
  106.          trace("labelATTENTE");
  107.          this._timeline_.GotoAndPlayUntil({
  108.             "labelPlay":this.mainTimeline.currentFrame + 1,
  109.             "labelStop":this.getNextLabel(),
  110.             "callback":this.afficheST
  111.          });
  112.       }
  113.       
  114.       public function G2D(value:int) : String
  115.       {
  116.          return GlobalesFunctions.gimme2digits(value);
  117.       }
  118.       
  119.       public function endMODULE() : void
  120.       {
  121.          trace("fin du module");
  122.          this._engine.host.changeModule({"numMod":0});
  123.       }
  124.       
  125.       public function sleep() : void
  126.       {
  127.          this._pauseManager = new PauseManager(this._engine,this._timelineManager);
  128.          this._pauseManager.sleepMovie(this.mainTimeline);
  129.       }
  130.       
  131.       public function wake() : void
  132.       {
  133.          this._pauseManager.wakeMovie(this.mainTimeline);
  134.       }
  135.       
  136.       public function destroy() : void
  137.       {
  138.          this._engine.stopAllSounds();
  139.          this._timeline_.kilListeners();
  140.       }
  141.    }
  142. }
  143.