AS2: AxisScroller

View Example
View Documentation
Download Class & Example Files

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.

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

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

7 Comments

i really like this class, but instantly i thought can i use both axisses on a movieClip.
i tried it but i didn't seem te get it working.

is there a way?

Br,

Max

When making the class originally, it was not intended to work on both axis, sorry. It is not possible to do with the way the class is set up because you'd have to have two of everything (tracks, scrollers, etc) and originally it was not anticipated. What you could do though, however, and i haven't tried this, is set up two instances of it, one horizontal and one vertical, and just use the same movieclip/mask as the clips to scroll.

let me know if that works out.

hehe, tried that. it doesn't work

when i get a bit of time here in the near future i'll try to see if i can come up with a solution.

Thanx man. It saved me a lot of time.

Thanx man. It saved me a lot of time. I'm already working with AS3 and Flex. An application of my client is based on AS2.

I really Loved this Class. Was very useful, this superseded all the classes with the .js functions, that liberated it self from conflicts.

Cheers.

Leave a comment

(required)

(required)