home *** CD-ROM | disk | FTP | other *** search
/ Mobiclic 145 / MOBICLIC145.ISO / pc / DATA / DSS145 / DSS145_06 / DSS145_06.swf / scripts / dss145_06 / BtRetour.as next >
Text File  |  2012-07-18  |  2KB  |  77 lines

  1. package dss145_06
  2. {
  3.    import com.milanpresse.engine.Engine;
  4.    import com.milanpresse.engine.initmovieclip.InteractiveMovie;
  5.    import com.milanpresse.engine.managers.TimelineManager;
  6.    import com.milanpresse.engine.medias.MediaSwf;
  7.    import com.milanpresse.engine.typeargument.NoiseObject;
  8.    import flash.net.SharedObject;
  9.    
  10.    public class BtRetour
  11.    {
  12.        
  13.       
  14.       private var BT_RETOUR:InteractiveMovie;
  15.       
  16.       private var gListDone:Array;
  17.       
  18.       private var gDoneDepart:Boolean;
  19.       
  20.       private var gameWon:Boolean = false;
  21.       
  22.       public function BtRetour(_engine:Engine, _timelineManager:TimelineManager, so:SharedObject)
  23.       {
  24.          var BT_RETOURswf:MediaSwf = null;
  25.          super();
  26.          BT_RETOURswf = _engine.showSwf({
  27.             "code":"BT_RETOUR",
  28.             "parent":_engine.config.layers["menu"]
  29.          });
  30.          this.gListDone = so.data.listDone;
  31.          this.gDoneDepart = this.gListDone[_engine.config.moduleNum - 1] == 1;
  32.          this.BT_RETOUR = new InteractiveMovie(BT_RETOURswf.swfContent,_timelineManager);
  33.          this.BT_RETOUR.gotoAndStop(1);
  34.          this.BT_RETOUR.mc.onRollOver = function(p:Object):void
  35.          {
  36.             this.gotoAndStop(2);
  37.             _engine.playNoise(new NoiseObject({"code":"B_RET"}));
  38.             _engine.showIB({
  39.                "id":"IB_RET",
  40.                "reference":BT_RETOURswf.swfContent
  41.             });
  42.          };
  43.          this.BT_RETOUR.mc.onRollOut = function(p:Object):void
  44.          {
  45.             this.gotoAndStop(1);
  46.             _engine.stopNoise(new NoiseObject({"code":"B_RET"}));
  47.             _engine.hideIB();
  48.          };
  49.          this.BT_RETOUR.mc.onPress = function(p:Object):void
  50.          {
  51.             _engine.stopNoise(new NoiseObject({"code":"B_RET"}));
  52.             this.kill();
  53.             if(gDoneDepart)
  54.             {
  55.                so.data.lastDone = 2;
  56.             }
  57.             else if(gameWon == true)
  58.             {
  59.                so.data.lastDone = 1;
  60.             }
  61.             else
  62.             {
  63.                so.data.lastDone = 0;
  64.             }
  65.             so.flush();
  66.             _engine.host.changeModule({"numMod":0});
  67.          };
  68.          this.BT_RETOUR.activeMC();
  69.       }
  70.       
  71.       public function set _gameWon(isWon:Boolean) : void
  72.       {
  73.          this.gameWon = isWon;
  74.       }
  75.    }
  76. }
  77.