home *** CD-ROM | disk | FTP | other *** search
/ Ice Age Fan CD 1 / CD1_Scrat.iso / flash / data / game.swf / scripts / asCode / howToPlayScreenClass.as < prev    next >
Encoding:
Text File  |  2012-07-04  |  2.2 KB  |  82 lines

  1. package asCode
  2. {
  3.    import com.adamsearle.events.TrackingEvent;
  4.    import com.terry.Broadcaster;
  5.    import flash.display.*;
  6.    import flash.events.*;
  7.    
  8.    public class howToPlayScreenClass extends MovieClip
  9.    {
  10.       public var okBtn:helpPlayBtnClip;
  11.       
  12.       public var helpNavBtnLeft:helpNavBtnClip;
  13.       
  14.       public var helpNavBtnRight:helpNavBtnClip;
  15.       
  16.       public var closeBtn:closeBtnClip;
  17.       
  18.       public var backBtn:HSD_back;
  19.       
  20.       private var currentHelpPage:int = 1;
  21.       
  22.       public function howToPlayScreenClass()
  23.       {
  24.          super();
  25.          helpNavBtnLeft.addEventListener(MouseEvent.CLICK,mouseDownHandler);
  26.          helpNavBtnRight.addEventListener(MouseEvent.CLICK,mouseDownHandler);
  27.          helpNavBtnLeft.buttonMode = true;
  28.          helpNavBtnRight.buttonMode = true;
  29.          evalButtons();
  30.       }
  31.       
  32.       private function mouseDownHandler(param1:MouseEvent) : void
  33.       {
  34.          switch(param1.target.name)
  35.          {
  36.             case "helpNavBtnRight":
  37.                ++currentHelpPage;
  38.                if(currentHelpPage > 2)
  39.                {
  40.                   currentHelpPage = 3;
  41.                }
  42.                evalButtons();
  43.                break;
  44.             case "helpNavBtnLeft":
  45.                --currentHelpPage;
  46.                if(currentHelpPage < 1)
  47.                {
  48.                   currentHelpPage = 1;
  49.                }
  50.                evalButtons();
  51.          }
  52.       }
  53.       
  54.       private function evalButtons() : void
  55.       {
  56.          this.gotoAndStop(currentHelpPage);
  57.          Broadcaster.dispatchEvent(new TrackingEvent(TrackingEvent.TRACK_PAGE,"/menu/instructions/" + currentHelpPage));
  58.          if(currentHelpPage < 2)
  59.          {
  60.             helpNavBtnLeft.alpha = 0.2;
  61.             helpNavBtnLeft.buttonMode = false;
  62.          }
  63.          else
  64.          {
  65.             helpNavBtnLeft.alpha = 1;
  66.             helpNavBtnLeft.buttonMode = true;
  67.          }
  68.          if(currentHelpPage > 2)
  69.          {
  70.             helpNavBtnRight.alpha = 0.2;
  71.             helpNavBtnRight.buttonMode = false;
  72.          }
  73.          else
  74.          {
  75.             helpNavBtnRight.buttonMode = true;
  76.             helpNavBtnRight.alpha = 1;
  77.          }
  78.       }
  79.    }
  80. }
  81.  
  82.