New Scrollbar Component
This modern scrollbar component will make it easy to scroll virtually any content you wish. It can be setup with very little effort and can be customized to suit your needs. You can use it to scroll static, dynamic, and input text objects. It can scroll MovieClips containing any content you wish to scroll. It can even be used to scroll content loaded from an external source at runtime.
This component will be included in a future installer of SWiSH Max2 and SWiSH miniMax2 but for now please download this component here - max2-contentscroller-component
You can also download the demo file shown above from here – scrollbar_component_sample
Unzip the files into the components folder in your SWiSH Max2 or SWiSH miniMax2 program folder. Unless you changed the default installation folder, the file path would typically be:
C:\Program Files\SWiSH Max2\components
or,
C:\Program Files\SWiSH miniMax2\components
If you are running Max2 (or miniMax) when you copy the component, you may need to refresh the component tree by right clicking on the tree in the Components panel then selecting ‘Reload’. To use the component, simply drag it into your movie.
I will give an overview of the available parameters along with a brief tutorial for scrolling various types of content below. Setting up the scrollbar is fairly simple; however, there are a few important things to remember.
Scrolling Text Only
The component comes with a text object included, so all you need to do is edited the text object to suit your needs (i.e. change the font, size, color, and text type).
- Drag the component onto the stage.
- Select the ContentScroller MovieClip in the Outline and open the Parameters window.
- Make sure the Target | Scroll Target is set to ‘textArea’.
- Edit the General Settings | Area Width and Area Height parameters and any other options you want.
- In the Outline panel, open the ContentScroller MovieClip and select the textArea object in the Outline.
- Edit the text properties in the Properties panel, if you are using Dynamic or Input text, make sure the “Auto-size height” option is disabled.
Note: If you change the text type to Static and then back to Dynamic or Input, the Auto-size height option will automatically be enabled. You will need to manually disable this on the Properties panel.
Scrolling Static Content
For best results, accumulate your static content OUTSIDE of the component (i.e. on the movie’s main timeline). Keep in mind that you can only scroll a single object with this component, so you will need to group any necessary content into either a MovieClip, a Group, or a Button.
When you have your static content grouped together, cut and paste it in place into the component.
If you are going to scroll anything other than a MovieClip, you need to ensure that the object is named and the Target option is selected on the Properties panel for that object.
Finally, change the Scroll Target parameter for the component to point to the named object or MovieClip you want to scroll.
Keep in mind, if your content is smaller than the Area Height, the scrollbar will not be needed and will be hidden when your movie is played.
Scrolling External Content
Detailed instructions for loading external content are beyond the scope of this tutorial but you need to set up the Scrollbar parameters just as you would for static content. If you are loading external text, then you would need to set the Scroll Target parameter to “textArea” and load your text into it. If you are loading dynamic static content, you would need to load it into a MovieClip defined as the Scroll Target.
You should set the Start on Load? parameter to False if loading external content. Use your own method to determine when your content has been loaded into the component. When it is loaded and displayed, you should call the SetScroll() function to initialize the scrollbar. For example:
ContentScroller.SetScroll();
Have some fun with this component and post comments or questions if you need assistance. I’ve added important notes and a description of the parameters for your reference.
Important Notes
Do not delete or change the name of the vertScroll, textArea, or scrollArea objects.
To change the dimensions (size) of the component, use the Area Width and Area Height parameters.
If static content (such as a MovieClip, Group, Shape, or Image) is used as the scroll target, the textArea object will automatically be hidden and excluded from export; however, it must remain for other features to function correctly.
If you want to scroll nothing but text (whether it be dynamic, input, or static) then all you need to do is type your text into the textArea object and alter the text properties on the Properties panel.
The “scrollArea” object is simply a visual guide for you to use. This object is used as a mask and will NOT be visible when you play or export your file. Think of it as a window … whatever content you choose to scroll will only be visible within that window. Any content hanging outside the boundaries of this object will not be visible. The “scrollArea” object also determines the height and position (location) of the scrollbar.
The specified Scroll Target object will have its transformation and reference points automatically set to the top-left position. Its X and Y coordinates will also be forced to 0 (zero) to align with the scrollArea object.
Parameters
| Parameter | Description |
| Target | Group: Define the target object and settings. |
| Scroll Target | The target object that you want to scroll. |
| Target Type | The type of item that will be scrolled (either Text or Object). This value will automatically be set based on your entry to the Scroll Target parameter. |
| Start On Load? | Determines whether or not the scrollbar initializes on load. Set this value to True if you have already defined the content you wish to scroll. Set this value to False if you will be loading or creating content at runtime (use the SetScroll() function to initialize at any point after load). |
| General Settings | Group: General Component Settings |
| Area Width | The width of the scrollable area (note: does not include the width or position of the scrollbar) |
| Area Height | The height of the scrollable area (note: does not include the width or position of the scrollbar) |
| Show Track? | Whether or not the scroll track is visible. |
| Show Slider Grip? | Whether or not the slider grip (handle) is shown or not. |
| Scrollbar Position and Alignment | Group |
| Horizontal Anchor | Whether the scrollbar is anchored to the left or right side |
| Vertical Anchor | Determines the vertical anchor: Top, Centered, Bottom |
| Horizontal Offset | The amount of distance between the scrollbar and scroll area |
| Scrollbar Dimensions | Group: Height and Width properties of the scrollbar |
| Slider Width | The width of the slider bar object. |
| Track Width | The width of the scrollbar track. |
| Mouse Action Colors | Group: Colors when the mouse interacts with the scrollbar. |
| Border Over Highlight | Highlight color when the mouse moves over the scrollbar. |
| Border Down Highlight | Highlight color when the mouse is pressed on the scrollbar. |
| Scrollbar Track Colors | Group: General colors for the scrollbar’s track. |
| Track Highlight | Color for the brightest part of the track (gradient). If you want a solid color for the track, use the same color for both the highlight and lowlight. |
| Track Lowlight | Color for the darkest part of the scrollbar (gradient). If you want a solid color for the track, use the same color for both the highlight and lowlight. |
| Track Border | The color of the track’s border. |
| Scrollbar Slider Colors | Group: Colors of the scrollbar’s slider. |
| Slider Highlight | Color for the brightest part of the slider (gradient). If you want a solid color for the slider, use the same color for both the highlight and lowlight. |
| Slider Lowlight | Color for the brightest part of the slider (gradient). If you want a solid color for the slider, use the same color for both the highlight and lowlight. |
| Slider Border | Color of the slider’s border |
| Corner Radius Settings | Group: The radius of each corner in the scrollbar |
| Top-Left Radius | The radius of the top-left corner. Note: This value will not exceed half of the shortest side of the scrollbar. |
| Top-Right Radius | The radius of the top-right corner. Note: This value will not exceed half of the shortest side of the scrollbar. |
| Bottom-Right Radius | The radius of the bottom-right corner. Note: This value will not exceed half of the shortest side of the scrollbar. |
| Bottom-Left Radius | The radius of the bottom-left corner. Note: This value will not exceed half of the shortest side of the scrollbar. |
Methods
| Method | Description |
| SetScroll() | The SetScroll function will initialize the scrollbar. Its main purpose is for loading external content into the scroller. Activate this function after the content has finished loading.Set the “Start on Load?” parameter to false to hide the scrollbar until your content is loaded then call this function. For example: ContentScroller.SetScroll(); |
| SetSize(w, h) | This function sets the width and height of the scrollable area. It behaves the same as using the Area Width and Area Height parameters. You can pass a numerical value with this function to specify the width and height. You can also pass a value of false to either argument to keep it from changing the dimensions. For example:ContentScroller.SetSize(300, 150); // This will change the scroll area’s width to 300 and height to 150 ContentScroller.SetSize(300, false); // This will change the scroll area’s width to 300 and will NOT change the height Notes: The component will always be anchored in the Top-Left and all resizing will be applied to the bottom and right sides. For Dynamic and Input text objects, the text object will be resized as well. For all other Static content (text and objects), only the viewable area and scrollbar will be resized. The dimensions of the content will not be altered. |
Tags: scrollbar


(8 votes, average: 4.50 out of 5)





cool component.
i’ve just released a similiar Easing Scrollbar component – eScrollbar.
The user can design the scrollbar simply by customizing moviclips / graphic shapes.
Special feautres:
Easing scrolling (customizable)
Fade out Edges
Mouse-wheel scrolling
any content-scrolling
http://www.orizens.com/wp/topics/easing-scrollbar-swishmax-component/
Hallo,
die deutsche Übersetzung gibt es hier:
http://www.swishkomponenten.de/category/scrollbar/
Tom
This is a really nice component, but is it possible to resize the text area on the fly at play time?
I’ve posted an explanation in the forums, but nobody seems to know how to do this:
http://forums.swishzone.com/index.php?showtopic=63748
Thanks for the updated component. Fantastic of you to add the feature. I have a small problem implementing it, which I added to the forum topic.
Me again! I have everything working, so great and many thanks.
However, I figured I would increase the size of the font at the same time as increasing the size of the component. I’ve tried this in several ways and it doesn’t work, including _text.size which I thought would work given it is a script object. Then it occurred to me that the component script probably overrides anything I might be scripting in order to redraw. Am I right, and if so, if there somewhere to resize the font in the script?
Hi
I’ve added to the forum thread about resizing the font at runtime with all my code. The code works in SWI with Movie clips and text fields of the same name as used by Scrollbar Component, but doesn’t work when I try and implement it on this component. There must be something in the component I’m missing?
The scrollbar doesn’t seem to initialise at smaller sizes. Just tried creating one of 115×75 and it won’t create the scrollbar. Any ideas?
Hi,
i add a easing for object mode scrolling.
Can find here:
http://forums.swishzone.com/index.php?showtopic=64174
Best Thomas