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

  1. package dss145_02
  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.       private var gameOn:Boolean = false;
  23.       
  24.       private var funcHide:Function;
  25.       
  26.       private var funcShow:Function;
  27.       
  28.       private var funcFin:Function;
  29.       
  30.       public function BtRetour(_engine:Engine, _timelineManager:TimelineManager, so:SharedObject)
  31.       {
  32.          var BT_RETOURswf:MediaSwf = null;
  33.          super();
  34.          BT_RETOURswf = _engine.showSwf({
  35.             "code":"BT_RETOUR",
  36.             "parent":_engine.config.layers["menu"]
  37.          });
  38.          this.gListDone = so.data.listDone;
  39.          this.gDoneDepart = this.gListDone[_engine.config.moduleNum - 1] == 1;
  40.          this.BT_RETOUR = new InteractiveMovie(BT_RETOURswf.swfContent,_timelineManager);
  41.          this.BT_RETOUR.gotoAndStop(1);
  42.          this.BT_RETOUR.mc.onRollOver = function(p:Object):void
  43.          {
  44.             funcHide();
  45.             this.gotoAndStop(2);
  46.             _engine.playNoise(new NoiseObject({"code":"B_RET"}));
  47.             _engine.showIB({
  48.                "id":"IB_RET",
  49.                "reference":BT_RETOURswf.swfContent
  50.             });
  51.          };
  52.          this.BT_RETOUR.mc.onRollOut = function(p:Object):void
  53.          {
  54.             funcShow();
  55.             this.gotoAndStop(1);
  56.             _engine.stopNoise(new NoiseObject({"code":"B_RET"}));
  57.             _engine.hideIB();
  58.          };
  59.          this.BT_RETOUR.mc.onPress = function(p:Object):void
  60.          {
  61.             _engine.stopNoise(new NoiseObject({"code":"B_RET"}));
  62.             this.kill();
  63.             if(gDoneDepart)
  64.             {
  65.                so.data.lastDone = 2;
  66.             }
  67.             else if(gameWon == true)
  68.             {
  69.                so.data.lastDone = 1;
  70.             }
  71.             else
  72.             {
  73.                so.data.lastDone = 0;
  74.             }
  75.             so.flush();
  76.             funcFin();
  77.          };
  78.          this.BT_RETOUR.activeMC();
  79.       }
  80.       
  81.       public function set _gameWon(isWon:Boolean) : void
  82.       {
  83.          this.gameWon = isWon;
  84.       }
  85.       
  86.       public function set _gameOn(isOn:Boolean) : void
  87.       {
  88.          this.gameOn = isOn;
  89.       }
  90.       
  91.       public function get _gameOn() : Boolean
  92.       {
  93.          return this.gameOn;
  94.       }
  95.       
  96.       public function setFunctionHideCursorSpecial(maFunction:Function) : void
  97.       {
  98.          this.funcHide = maFunction;
  99.       }
  100.       
  101.       public function setFunctionShowCursorSpecial(maFunction:Function) : void
  102.       {
  103.          this.funcShow = maFunction;
  104.       }
  105.       
  106.       public function setFunctionFin(maFunction:Function) : void
  107.       {
  108.          this.funcFin = maFunction;
  109.       }
  110.    }
  111. }
  112.