AS2: AxisScroller v2.0

View Example
View Documentation
Download Class & Example Files

This is the latest update to the AxisScroller. This update adds a new optionalParameter, continuousScroll, which allows you to scroll (if the arrows are active) continuously by just pressing down one of the arrows. There is also a new method, reset(), that resets the scroller and content movie clips to its original positions. Lastly, some of the code was condensed to promote reuse. If you're using the AxisScroller, definitely upgrade to this version. The syntax for usage was all kept in tact so you should have no problems just replacing this in a project (nothing should be broken because of it).

Actionscript:
  1. import mx.utils.Delegate;
  2. import mx.transitions.easing.*;
  3. import mx.transitions.Tween;
  4.  
  5. /**
  6. * Creates a scroller that allows for scrolling in the x or y axis, using the mouse wheel/arrow keys, different easing functions and types, and some other miscellaneous cool things.
  7. *
  8. * @usage
  9. * <code>
  10. * <pre>
  11. import com.reintroducing.ui.AxisScroller;
  12. stop();
  13. var optionalObj:Object = new Object(
  14. {
  15.     scrollType: "easing",
  16.     isTrackClickable: true,
  17.     useArrows: true,
  18.     upArrow: content_mc.up_btn,
  19.     downArrow: content_mc.down_btn,
  20.     continuousScroll: true,
  21.     easeFunc: Regular.easeOut,
  22.     duration: .25,
  23.     arrowMove: 50,
  24.     scaleScroller: true,
  25.     autoHideControls: true
  26. });
  27. var scroller:AxisScroller = new AxisScroller(content_mc, content_mc.scroller_mc, content_mc.movie_mc, content_mc.track_mc, content_mc.mask_mc, "y", optionalObj);
  28. * </pre>
  29. * </code>
  30. *
  31. * @author Matt Przybylski [http://www.reintroducing.com]
  32. * @version 2.0
  33. */
  34.  
  35. class com.reintroducing.ui.AxisScroller
  36. {
  37. //- PRIVATE VARIABLES -------------------------------------------------------------------------------------
  38.    
  39.     private var _changeProp:String;
  40.     private var _mouseAxis:String;
  41.     private var _changeScale:String;
  42.     private var _nextPosition:Number;
  43.     private var _arrowMove:Number;
  44.     private var _scaleScroller:Boolean;
  45.     private var _autoHideControls:Boolean;
  46.     private var _mouseIsPressedDown:Boolean;
  47.     private var _trackOffset:Number;
  48.     private var _trackStart:Number;
  49.     private var _trackEnd:Number;
  50.     private var _tween:Tween;
  51.     private var _arrow1Tween:Tween;
  52.     private var _arrow2Tween:Tween;
  53.     private var _scrollerTween:Tween;
  54.     private var _trackTween:Tween;
  55.     private var _easeFunc:Function;
  56.     private var _duration:Number;
  57.     private var _holder:MovieClip;
  58.     private var _scroller:MovieClip;
  59.     private var _toBeScrolled:MovieClip;
  60.     private var _track:MovieClip;
  61.     private var _mask:MovieClip;
  62.     private var _axis:String;
  63.     private var _scrollType:String;
  64.     private var _isTrackClickable:Boolean;
  65.     private var _arrows:Boolean;
  66.     private var _upArrow:MovieClip;
  67.     private var _downArrow:MovieClip;
  68.     private var _continuousScroll:Boolean;
  69.     private var _arrowTimer:Number;
  70.     private var _arrowPressed:String;
  71.    
  72. //- PUBLIC VARIABLES --------------------------------------------------------------------------------------
  73.    
  74.     public static var DEFAULT_NAME:String = "com.reintroducing.ui.AxisScroller";
  75.  
  76. //- CONSTRUCTOR -------------------------------------------------------------------------------------------
  77.    
  78.     /**
  79.      * Creates a new instance of the AxisScroller class.
  80.      *
  81.      * <p>
  82.      * The $optionalParams parameter takes in a couple of values.
  83.      * <ul>
  84.      * <li>scrollType: A string representing the scroll type, "instant" or "easing" (default: "easing")</li>
  85.      * <li>isTrackClickable: A boolean value that makes the track clickable so that you can scroll directly to a certain spot (default: true)</li>
  86.      * <li>useArrows: A boolean value that allows the use of arrow buttons (default: false)</li>
  87.      * <li>upArrow: If useArrows, a movie clip that represents the up arrow button (default: null)</li>
  88.      * <li>downArrow: If useArrows, a movie clip that represents the down arrow button (default: null)</li>
  89.      * <li>continuousScroll: If useArrows, a boolean that specifies if when pressing the arrows the scrolling should happen continuously or not (default: false)</li>
  90.      * <li>easeFunc: A function representing the ease type you'd like to use, as per the Tween class easing functions (default: Regular.easeOut)</li>
  91.      * <li>duration: An integer (in seconds) representing the time that the scrollable content will take to move when easing is used (default: .25)</li>
  92.      * <li>arrowMove: An integer (in pixels) that the scrollable content will move onMouseWheel/Key/Arrow movement (default: 100)</li>
  93.      * <li>autoHideControls: A boolean value that hides the scroller/track/arrows (if applicable) if the scroll content is too small to scroll (default: false)</li>
  94.      * <li>scaleScroller *: A boolean value that allows automatic scaling of the scroll bar (default: false)</li>
  95.      * </ul>
  96.      * * If you use the scaleScroller optional parameter, please make the size of the scroll bar the same size as the track and this will take care of
  97.      * scaling it automatically for you.  If you AREN'T using this parameter, please size your scroll bar accordingly manually.
  98.      * </p>
  99.      *
  100.      * @usage <pre><code>var scroller:AxisScroller = new AxisScroller($holder, $scroller, $toBeScrolled, $track, $mask, $axis, $optionalParams);</code></pre>
  101.      *
  102.      * @param $holder The movie clip (or timeline) that holds all of the other clips corresponding to the scroller
  103.      * @param $scroller The movie clip to be used as the scroller
  104.      * @param $toBeScrolled The movie clip where the scrollable content resides
  105.      * @param $track The movie clip that is used as the track (measures extremes)
  106.      * @param $mask The movie clip that is used as the mask for the scrollable content area
  107.      * @param $axis A string value of either "x" or "y" that determines what axis the content is scrolled along
  108.      * @param $optionalParams Optional parameters to further control the scroller
  109.      */
  110.    
  111.     public function AxisScroller($holder:MovieClip, $scroller:MovieClip, $toBeScrolled:MovieClip, $track:MovieClip, $mask:MovieClip, $axis:String, $optionalParams:Object)
  112.     {
  113.         this._holder                = $holder;
  114.         this._scroller      = $scroller;
  115.         this._toBeScrolled     = $toBeScrolled;
  116.         this._track                     = $track;
  117.         this._mask       = $mask;
  118.         this._axis       = "_" + $axis;
  119.        
  120.         this._scrollType             = ($optionalParams.scrollType == undefined) ? "easing" : $optionalParams.scrollType;
  121.         this._isTrackClickable    = ($optionalParams.isTrackClickable == undefined) ? true : $optionalParams.isTrackClickable;
  122.         this._arrows                = ($optionalParams.useArrows == undefined) ? false : $optionalParams.useArrows;
  123.         this._upArrow           = ($optionalParams.upArrow == undefined) ? null : $optionalParams.upArrow;
  124.         this._downArrow                 = ($optionalParams.downArrow == undefined) ? null : $optionalParams.downArrow;
  125.         this._continuousScroll      = ($optionalParams.continuousScroll == undefined) ? false : $optionalParams.continuousScroll;
  126.         this._easeFunc      = ($optionalParams.easeFunc == undefined) ? Regular.easeOut : $optionalParams.easeFunc;
  127.         this._duration      = ($optionalParams.duration == undefined) ? .25 : $optionalParams.duration;
  128.         this._arrowMove                 = ($optionalParams.arrowMove == undefined) ? 100 : $optionalParams.arrowMove;
  129.         this._autoHideControls      = ($optionalParams.autoHideControls == undefined) ? false : $optionalParams.autoHideControls;
  130.         this._scaleScroller    = ($optionalParams.scaleScroller == undefined) ? false : $optionalParams.scaleScroller;
  131.        
  132.         this.manageAxis(this._axis);
  133.         this.init();
  134.     }
  135.    
  136. //- PRIVATE METHODS ---------------------------------------------------------------------------------------
  137.    
  138.     // initiates listeners and other events
  139.     private function init():Void
  140.     {
  141.         Mouse.addListener(this);
  142.         Key.addListener(this);
  143.        
  144.         this._holder.onEnterFrame       = Delegate.create(this, manageScrolling);
  145.        
  146.         this.activateButtonEvents();
  147.     }
  148.    
  149.     // re-activates the button events
  150.     private function activateButtonEvents():Void
  151.     {
  152.         this._scroller.onPress     = Delegate.create(this, manageMouseDown);
  153.        
  154.         this._scroller.onRelease = this._scroller.onReleaseOutside = Delegate.create(this, manageMouseUp);
  155.         this._scroller.useHandCursor = true;
  156.        
  157.         if (this._isTrackClickable)
  158.         {
  159.             this._track.onRelease       = Delegate.create(this, manageTrack);
  160.             this._track.useHandCursor      = true;
  161.         }
  162.        
  163.         if (this._arrows)
  164.         {
  165.             this._upArrow.onPress        = Delegate.create(this, manageUpArrow);
  166.             this._upArrow.onRelease         = Delegate.create(this, resetArrowTimer);
  167.            
  168.             this._downArrow.onPress         = Delegate.create(this, manageDownArrow);
  169.             this._downArrow.onRelease     = Delegate.create(this, resetArrowTimer);
  170.            
  171.             this._downArrow.useHandCursor = this._upArrow.useHandCursor = true;
  172.         }
  173.     }
  174.    
  175.     // destroys the events on the buttons
  176.     private function killButtonEvents():Void
  177.     {
  178.         this._scroller.onPress = this._scroller.onRelease = this._scroller.onReleaseOutside = null;
  179.         this._scroller.useHandCursor = false;
  180.        
  181.         if (this._isTrackClickable)
  182.         {
  183.             this._track.onRelease = null;
  184.             this._track.useHandCursor = false;
  185.         }
  186.        
  187.         if (this._arrows)
  188.         {
  189.             this._upArrow.onPress = this._downArrow.onPress = null;
  190.             this._upArrow.onRelease = this._downArrow.onRelease = null;
  191.             this._upArrow.useHandCursor = this._downArrow.useHandCursor = false;
  192.         }
  193.     }
  194.    
  195.     // sets the axis at which the scroller will function against
  196.     private function manageAxis($axis:String):Void
  197.     {
  198.         if ($axis == "_x")
  199.         {
  200.             this._changeProp          = "_width";
  201.             this._mouseAxis             = "_xmouse";
  202.             this._changeScale         = "_xscale";
  203.         }
  204.         else if ($axis == "_y")
  205.         {
  206.             this._changeProp          = "_height";
  207.             this._mouseAxis             = "_ymouse";
  208.             this._changeScale         = "_yscale";
  209.         }
  210.        
  211.         this._trackOffset         = - (this._scroller[this._changeProp] / 2);
  212.     }
  213.    
  214.     // calculates values and responds to changes by the scroller
  215.     private function manageScrolling():Void
  216.     {
  217.         var trackSize:Number          = this._track[this._changeProp];
  218.         var trackStart:Number       = this._track[this._axis];
  219.         var trackEnd:Number             = this._track[this._axis] + trackSize - (this._scroller[this._changeProp]);
  220.         var trackRange:Number       = trackEnd - trackStart;
  221.         var maskSize:Number             = this._mask[this._changeProp];
  222.         var movieSize:Number          = this._toBeScrolled[this._changeProp];
  223.         var minPosition:Number    = this._mask[this._axis] + 2;
  224.         var maxPosition:Number    = minPosition + movieSize - maskSize + 4;
  225.         var onePercentChange:Number     = (maxPosition - minPosition) / 100;
  226.         var percent:Number     = Math.round(((this._scroller[this._axis] - trackStart) / trackRange) * 100);
  227.         var targetPosition:Number     = Math.round(minPosition - (onePercentChange * percent));
  228.        
  229.         this._trackStart             = trackStart;
  230.         this._trackEnd      = trackEnd;
  231.        
  232.         if (this._scrollType == "instant")
  233.         {
  234.             this._toBeScrolled[this._axis] = targetPosition;
  235.         }
  236.         else if (this._scrollType == "easing")
  237.         {
  238.             this._toBeScrolled[this._axis] += Math.round((targetPosition - this._toBeScrolled[this._axis]) / 5);
  239.         }
  240.  
  241.         if (movieSize <maskSize)
  242.         {
  243.             onePercentChange = 0;
  244.         }
  245.        
  246.         if (this._mouseIsPressedDown)
  247.         {
  248.             this._scroller[this._axis] = Math.round(this._holder[this._mouseAxis] - (this._scroller[this._changeProp] / 2));
  249.         }
  250.        
  251.         if (this._scroller[this._axis] <trackStart)
  252.         {
  253.             this._scroller[this._axis] = Math.round(trackStart);
  254.         }
  255.         else if (this._scroller[this._axis]> trackEnd)
  256.         {
  257.             this._scroller[this._axis] = Math.round(trackEnd);
  258.         }
  259.        
  260.         if (this._scaleScroller) this.manageScrollScaling(movieSize, maskSize);
  261.        
  262.         this.manageControls(this._autoHideControls, movieSize, maskSize);
  263.     }
  264.    
  265.     // regulates mouse pressed down
  266.     private function manageMouseDown():Void
  267.     {
  268.         this._mouseIsPressedDown = true;
  269.     }
  270.    
  271.     // regulates mouse released
  272.     private function manageMouseUp():Void
  273.     {
  274.         this._mouseIsPressedDown = false;
  275.     }
  276.    
  277.     // moves the scroller up when the up arrow is clicked
  278.     private function moveUp():Void
  279.     {
  280.         if (this._scrollType == "instant")
  281.         {
  282.             this._nextPosition = Math.round(this._scroller[this._axis] - this._arrowMove);
  283.            
  284.             if (this._nextPosition <this._trackStart)
  285.             {
  286.                 this._scroller[this._axis] = this._trackStart;
  287.             }
  288.             else
  289.             {
  290.                 this._scroller[this._axis] = this._nextPosition;
  291.             }
  292.         }
  293.         else if (this._scrollType == "easing")
  294.         {
  295.             this._nextPosition = Math.round(this._scroller[this._axis] - this._arrowMove);
  296.            
  297.             if (this._nextPosition <this._trackStart)
  298.             {
  299.                 this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._trackStart, this._duration, true);
  300.             }
  301.             else
  302.             {
  303.                 this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._nextPosition, this._duration, true);
  304.             }
  305.         }
  306.     }
  307.    
  308.     // moves the scroller down when the down arrow is clicked
  309.     private function moveDown():Void
  310.     {
  311.         if (this._scrollType == "instant")
  312.         {
  313.             this._nextPosition = Math.round(this._scroller[this._axis] + this._arrowMove);
  314.            
  315.             if (this._nextPosition> this._trackEnd)
  316.             {
  317.                 this._scroller[this._axis] = this._trackEnd;
  318.             }
  319.             else
  320.             {
  321.                 this._scroller[this._axis] = this._nextPosition;
  322.             }
  323.         }
  324.         else if (this._scrollType == "easing")
  325.         {
  326.             this._nextPosition = Math.round(this._scroller[this._axis] + this._arrowMove);
  327.            
  328.             if (this._nextPosition> this._trackEnd)
  329.             {
  330.                 this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._trackEnd, this._duration, true);
  331.             }
  332.             else
  333.             {
  334.                 this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._nextPosition, this._duration, true);
  335.             }
  336.         }
  337.     }
  338.    
  339.     // regulates the movement of the up arrow, if applicable
  340.     private function manageUpArrow():Void
  341.     {
  342.         if (this._continuousScroll)
  343.         {
  344.             this._arrowPressed = "up";
  345.             this._arrowTimer = setInterval(this, "manageContinuousScroll", 80);
  346.         }
  347.         else
  348.         {
  349.             this.moveUp();
  350.         }
  351.     }
  352.    
  353.     // regulates the movement of the down arrow, if applicable
  354.     private function manageDownArrow():Void
  355.     {
  356.         if (this._continuousScroll)
  357.         {
  358.             this._arrowPressed = "down";
  359.             this._arrowTimer = setInterval(this, "manageContinuousScroll", 80);
  360.         }
  361.         else
  362.         {
  363.             this.moveDown();
  364.         }
  365.     }
  366.    
  367.     // if continuous scroll is on, manages the timer that moves it up and down
  368.     private function manageContinuousScroll():Void
  369.     {
  370.         if (this._arrowPressed == "up")
  371.         {
  372.             this.moveUp();
  373.         }
  374.         else if (this._arrowPressed == "down")
  375.         {
  376.             this.moveDown();
  377.         }
  378.     }
  379.    
  380.     // if continuous scroll is on, resets the timer after you release an arrow button
  381.     private function resetArrowTimer():Void
  382.     {
  383.         if (this._continuousScroll)
  384.         {
  385.             clearInterval(this._arrowTimer);
  386.         }
  387.     }
  388.    
  389.     // regulates the movement of the content based on where the track is clicked, if applicable
  390.     private function manageTrack():Void
  391.     {
  392.         if (this._isTrackClickable)
  393.         {
  394.             if (this._scrollType == "instant")
  395.             {
  396.                 if (this._holder[this._mouseAxis] <this._trackStart)
  397.                 {
  398.                     this._scroller[this._axis] = this._trackStart;
  399.                 }
  400.                 else if (this._holder[this._mouseAxis]> this._trackEnd)
  401.                 {
  402.                     this._scroller[this._axis] = this._trackEnd;
  403.                 }
  404.                 else
  405.                 {
  406.                     this._scroller[this._axis] = Math.round(this._holder[this._mouseAxis] - (this._scroller[this._changeProp] / 2));
  407.                 }
  408.             }
  409.             else if (this._scrollType == "easing")
  410.             {
  411.                 if (this._holder[this._mouseAxis] <this._trackStart)
  412.                 {
  413.                     this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._trackStart, this._duration, true);
  414.                 }
  415.                 else if (this._holder[this._mouseAxis]> this._trackEnd)
  416.                 {
  417.                     this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._trackEnd, this._duration, true);
  418.                 }
  419.                 else
  420.                 {
  421.                     this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], Math.round(this._holder[this._mouseAxis] - (this._scroller[this._changeProp] / 2)), this._duration, true);
  422.                 }
  423.             }
  424.         }
  425.     }
  426.    
  427.     // auto hides/shows the controls of the scroller
  428.     private function manageControls($isAutoHideEnabled:Boolean, $contentSize:Number, $maskSize:Number):Void
  429.     {
  430.         if ($isAutoHideEnabled && $contentSize <= $maskSize)
  431.         {
  432.             // yes, hide controls
  433.             this._arrow1Tween   = new Tween(this._upArrow, "_alpha", this._easeFunc, this._upArrow._alpha, 0, this._duration, true);
  434.             this._arrow2Tween   = new Tween(this._downArrow, "_alpha", this._easeFunc, this._downArrow._alpha, 0, this._duration, true);
  435.             this._scrollerTween = new Tween(this._scroller, "_alpha", this._easeFunc, this._scroller._alpha, 0, this._duration, true);
  436.             this._trackTween    = new Tween(this._track, "_alpha", this._easeFunc, this._track._alpha, 0, this._duration, true);
  437.            
  438.             this.killButtonEvents();
  439.         }
  440.         else
  441.         {
  442.             // no, show controls
  443.             this._arrow1Tween   = new Tween(this._upArrow, "_alpha", this._easeFunc, this._upArrow._alpha, 100, this._duration, true);
  444.             this._arrow2Tween   = new Tween(this._downArrow, "_alpha", this._easeFunc, this._downArrow._alpha, 100, this._duration, true);
  445.             this._scrollerTween = new Tween(this._scroller, "_alpha", this._easeFunc, this._scroller._alpha, 100, this._duration, true);
  446.             this._trackTween    = new Tween(this._track, "_alpha", this._easeFunc, this._track._alpha, 100, this._duration, true);
  447.            
  448.             this.activateButtonEvents();
  449.         }
  450.     }
  451.    
  452.     // regulates the scaling of the scroller, if applicable
  453.     private function manageScrollScaling($contentSize:Number, $maskSize:Number):Void
  454.     {
  455.         var trackPercent:Number = Math.ceil(($maskSize / $contentSize) * 100);
  456.        
  457.         if ($contentSize> $maskSize)
  458.         {
  459.             this._scroller[this._changeScale] = trackPercent;
  460.         }
  461.         else
  462.         {
  463.             this._scroller[this._changeScale] = 100;
  464.         }
  465.     }
  466.    
  467.     // regulates the movement of the mouse wheel
  468.     private function onMouseWheel($delta:Number):Void
  469.     {
  470.         var multiplier:Number = 10;
  471.        
  472.         if (this._scrollType == "instant")
  473.         {
  474.             this._nextPosition = Math.round(this._scroller[this._axis] - ($delta * multiplier));
  475.            
  476.             if (this._nextPosition <this._trackStart)
  477.             {
  478.                 this._scroller[this._axis] = this._trackStart;
  479.             }
  480.             else if (this._nextPosition> this._trackEnd)
  481.             {
  482.                 this._scroller[this._axis] = this._trackEnd;
  483.             }
  484.             else
  485.             {
  486.                 this._scroller[this._axis] = this._nextPosition;
  487.             }
  488.         }
  489.         else if (this._scrollType == "easing")
  490.         {
  491.             this._nextPosition = Math.round(this._scroller[this._axis] - ($delta * multiplier));
  492.            
  493.             if (this._nextPosition <this._trackStart)
  494.             {
  495.                 this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._trackStart, this._duration, true);
  496.             }
  497.             else if (this._nextPosition> this._trackEnd)
  498.             {
  499.                 this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._trackEnd, this._duration, true);
  500.             }
  501.             else
  502.             {
  503.                 this._tween = new Tween(this._scroller, this._axis, this._easeFunc, this._scroller[this._axis], this._nextPosition, this._duration, true);
  504.             }
  505.         }
  506.     }
  507.    
  508.     // regulates the movement of the up and down keyboard keys
  509.     private function onKeyDown():Void
  510.     {
  511.         if (this._axis == "_x")
  512.         {
  513.             switch(Key.getCode())
  514.             {
  515.                 case 37: // left
  516.                     this.moveUp();
  517.                     break;
  518.                    
  519.                 case 39: // right
  520.                     this.moveDown();
  521.                     break;
  522.             }
  523.         }
  524.         else if (this._axis == "_y")
  525.         {
  526.             switch(Key.getCode())
  527.             {
  528.                 case 38: // up
  529.                     this.moveUp();
  530.                     break;
  531.                    
  532.                 case 40: // down
  533.                     this.moveDown();
  534.                     break;
  535.             }
  536.         }
  537.     }
  538.    
  539. //- PUBLIC METHODS ----------------------------------------------------------------------------------------
  540.    
  541.     /**
  542.      * Creates the scroller again if it was deleted using destroy.
  543.      *
  544.      * @usage <pre><code>scroller.create();</code></pre>
  545.      *
  546.      * @return Nothing
  547.      */
  548.    
  549.     public function create():Void
  550.     {
  551.         this.init();
  552.     }
  553.        
  554.     /**
  555.      * Resets the position of the scroller and the content movie clip to its initial position.
  556.      *
  557.      * @usage <pre><code>scroller.reset();</code></pre>
  558.      *
  559.      * @return Nothing
  560.      */
  561.    
  562.     public function reset():Void
  563.     {
  564.         this._scroller[this._axis] = this._trackStart;
  565.     }
  566.    
  567.     /**
  568.      * Clears the enterFrame and removes the listeners/events.
  569.      *
  570.      * @usage <pre><code>scroller.destroy();</code></pre>
  571.      *
  572.      * @return Nothing
  573.      */
  574.    
  575.     public function destroy():Void
  576.     {
  577.         delete this._holder.onEnterFrame;
  578.         Mouse.removeListener(this);
  579.         Key.removeListener(this);
  580.        
  581.         this.killButtonEvents();
  582.     }
  583.    
  584. //- EVENT HANDLERS ----------------------------------------------------------------------------------------
  585.    
  586.    
  587.    
  588. //- GETTERS & SETTERS -------------------------------------------------------------------------------------
  589.    
  590.     /**
  591.      * Gets the value of autoHideControls to see if they are currently being hidden or not.
  592.      *
  593.      * @usage <pre><code>trace(scroller.autoHideControls);</code></pre>
  594.      *
  595.      * @return Boolean
  596.      */
  597.    
  598.     public function get autoHideControls():Boolean
  599.     {
  600.         return this._autoHideControls;
  601.     }
  602.    
  603.     /**
  604.      * Sets the value of autoHideControls "on-the-fly".
  605.      *
  606.      * @usage <pre><code>scroller.autoHideControls = true;</code></pre>
  607.      *
  608.      * @return Nothing
  609.      */
  610.    
  611.     public function set autoHideControls($b:Boolean):Void
  612.     {
  613.         this._autoHideControls = $b;
  614.     }
  615.    
  616. //- HELPERS -----------------------------------------------------------------------------------------------
  617.    
  618.     public function toString():String
  619.     {
  620.         return "com.reintroducing.ui.AxisScroller";
  621.     }
  622.    
  623. //- END CLASS ---------------------------------------------------------------------------------------------
  624. }

If you found this post useful, please consider leaving a comment, subscribing to the feed, or making a small donation.

No Comments

No comments yet.

Leave a comment

(required)

(required)