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

  1. package dss145_10
  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.tools.GlobalesFunctions;
  9.    import flash.display.MovieClip;
  10.    import flash.display.Sprite;
  11.    import flash.net.SharedObject;
  12.    
  13.    public class CapsuleAlgo
  14.    {
  15.        
  16.       
  17.       private var _e:EngineExt;
  18.       
  19.       private var mainClip:MediaSwf;
  20.       
  21.       private var mainTimeline:MovieClip;
  22.       
  23.       private var _engine:Engine;
  24.       
  25.       private var _timeline_:TimelineLinear;
  26.       
  27.       private var _timelineManager:TimelineManager;
  28.       
  29.       private var labelsCallback:Object;
  30.       
  31.       private var firstLabel:String;
  32.       
  33.       private var so:SharedObject;
  34.       
  35.       private var gListDone:Array;
  36.       
  37.       private var gDoneDepart:Boolean;
  38.       
  39.       private var _clipBloquant:Sprite;
  40.       
  41.       private var BT_RETOUR:BtRetour;
  42.       
  43.       private var CURSEUR:Cursor;
  44.       
  45.       public function CapsuleAlgo(param1:Engine)
  46.       {
  47.          var engine:Engine = param1;
  48.          this.labelsCallback = {};
  49.          super();
  50.          this._engine = engine;
  51.          this._timelineManager = new TimelineManager();
  52.          this._e = new EngineExt(this._engine,this._timelineManager);
  53.          this._engine.logsTrace();
  54.          if(this._engine.config.musicOn == true)
  55.          {
  56.             this._engine.playMusic({"code":"MU"});
  57.          }
  58.          this._engine.setSubtitles(this._engine.host.subtitlesOn);
  59.          this._engine.setFrameRate(12);
  60.          this.CURSEUR = new Cursor(this._engine.getMediaSwf("CURSEUR").swfContent,this._engine.config.layers["top"]);
  61.          this._e.instanceToDestroyAdd(this.CURSEUR);
  62.          this.mainClip = this._engine.showSwf({
  63.             "code":"A_" + this._engine.config.moduleName,
  64.             "parent":this._engine.config.layers["content"]
  65.          });
  66.          this.mainTimeline = this.mainClip.swfContent;
  67.          this._timeline_ = new TimelineLinear(this.mainTimeline,this._engine,this,this._timelineManager,this.labelsCallback);
  68.          this._engine.levelCZ = this._engine.config.layers["content"];
  69.          this._clipBloquant = GlobalesFunctions.createRectangle({
  70.             "x":0,
  71.             "y":0,
  72.             "w":800,
  73.             "h":600,
  74.             "alpha":0
  75.          }) as MovieClip;
  76.          this.firstLabel = this.mainTimeline.currentLabels[0].name;
  77.          this._timeline_.GotoAndPlayUntil({"labelStop":this.firstLabel});
  78.          this.so = SharedObject.getLocal(this._engine.config.rubriqueName,"/");
  79.          this.gListDone = this.so.data.listDone;
  80.          this.gDoneDepart = this.gListDone[this._engine.config.moduleNum - 1] == 1;
  81.          this.BT_RETOUR = new BtRetour(this._engine,this._timelineManager,this.so);
  82.          this.BT_RETOUR.setFunctionHideCursorSpecial(function():void
  83.          {
  84.          });
  85.          this.BT_RETOUR.setFunctionShowCursorSpecial(function():void
  86.          {
  87.          });
  88.       }
  89.       
  90.       public function labelATTENTE_PARCHEMIN() : void
  91.       {
  92.          var _loc1_:AttenteParchemin = new AttenteParchemin(this._e,this.labelATTENTE_PARCHEMIN_CALLBACK);
  93.          var _loc2_:int = 1;
  94.          while(_loc2_ <= 10)
  95.          {
  96.             _loc1_.config.BUTTONS.push(this.mainTimeline.getChildByName("BT_" + GlobalesFunctions.gimme2digits(_loc2_)));
  97.             _loc2_++;
  98.          }
  99.          _loc1_.config.BT_CROIX = this.mainTimeline.getChildByName("BT_CROIX");
  100.          _loc1_.init();
  101.       }
  102.       
  103.       private function labelATTENTE_PARCHEMIN_CALLBACK() : void
  104.       {
  105.          this._timeline_.GotoAndPlayUntil({"labelStop":"_12"});
  106.       }
  107.       
  108.       public function labelATTENTE_JEU() : void
  109.       {
  110.          var _loc1_:AttenteJeu = new AttenteJeu(this._e,this.labelATTENTE_JEU_CALLBACK);
  111.          _loc1_.CURSEUR = this.CURSEUR;
  112.          _loc1_.config.CONTAINER = this.mainTimeline;
  113.          _loc1_.config.mainAlgo = this;
  114.          _loc1_.config.BT_REJOUER = this.mainTimeline.getChildByName("BT_REJOUER");
  115.          _loc1_.config.HERAKLES = this.mainTimeline.getChildByName("HERAKLES");
  116.          _loc1_.config.GERYON = this.mainTimeline.getChildByName("GERYON");
  117.          _loc1_.config.BT_FLECHE_DO = this.mainTimeline.getChildByName("BT_FLECHE_DO");
  118.          _loc1_.config.BT_FLECHE_UP = this.mainTimeline.getChildByName("BT_FLECHE_UP");
  119.          _loc1_.config.BT_AIDE = this.mainTimeline.getChildByName("BT_AIDE");
  120.          _loc1_.config.CLIP_AIDE = this.mainTimeline.getChildByName("CLIP_AIDE");
  121.          _loc1_.config.JAUGE = this.mainTimeline.getChildByName("JAUGE");
  122.          _loc1_.config.BLOC_QUESTIONS = this.mainTimeline.getChildByName("BANQUE_QUESTIONS");
  123.          _loc1_.config.BLOC_QUESTIONS_DRAG = new BANQUE_QUESTION();
  124.          _loc1_.init();
  125.       }
  126.       
  127.       private function labelATTENTE_JEU_CALLBACK() : void
  128.       {
  129.          this.BT_RETOUR.visible = false;
  130.          this.save();
  131.          this._timeline_.GotoAndPlayUntil({"labelStop":"_16"});
  132.       }
  133.       
  134.       public function labelATTENTE_FIN() : void
  135.       {
  136.          this.endMODULE();
  137.       }
  138.       
  139.       public function G2D(param1:int) : String
  140.       {
  141.          return GlobalesFunctions.gimme2digits(param1);
  142.       }
  143.       
  144.       public function save() : void
  145.       {
  146.          this.BT_RETOUR._gameWon = true;
  147.          this.gListDone[this._engine.config.moduleNum - 1] = 1;
  148.          if(this.gDoneDepart)
  149.          {
  150.             this.so.data.lastDone = 2;
  151.          }
  152.          else
  153.          {
  154.             this.so.data.lastDone = 1;
  155.          }
  156.          this.so.data.listDone = this.gListDone;
  157.          this.so.flush();
  158.       }
  159.       
  160.       public function endMODULE() : void
  161.       {
  162.          this.gListDone[this._engine.config.moduleNum - 1] = 1;
  163.          if(this.gDoneDepart)
  164.          {
  165.             this.so.data.lastDone = 2;
  166.          }
  167.          else
  168.          {
  169.             this.so.data.lastDone = 1;
  170.          }
  171.          this.so.data.listDone = this.gListDone;
  172.          this.so.flush();
  173.          this._engine.host.changeModule({"numMod":0});
  174.       }
  175.       
  176.       public function sleep() : void
  177.       {
  178.          this._e.movieClipSleep(this.mainTimeline);
  179.       }
  180.       
  181.       public function wake() : void
  182.       {
  183.          this._e.movieClipWake(this.mainTimeline);
  184.       }
  185.       
  186.       public function destroy() : void
  187.       {
  188.          this._timeline_.kilListeners();
  189.          this._e.destroy();
  190.       }
  191.    }
  192. }
  193.