My account
Shopping cart
Knowledge base
Support


Usage and Code Samples for ScrollBar Pro V1 Flash Component



ScrollBar Pro V1 Usage and Code Samples

In order to use your own movie clips, they have to use the following linkage ids:
- "hsLeftButton" for the left button of the horizontal scroll bar
- "hsRightButton" for the right button of the horizontal scroll bar
- "hsScrollButton" for the scroll button of the horizontal scroll bar
- "hsScrollbarBackground" for the background of the horizontal scroll bar (the area on which the scroll button moves)
- "vsLeftButton" for the left button of the vertical scroll bar
- "vsRightButton" for the right button of the vertical scroll bar
- "vsScrollButton" for the scroll button of the vertical scroll bar
- "vsScrollbarBackground" for the background of the vertical scroll bar (the area on which the scroll button moves)

The component can also be customized by assigning the linkage ids to the corresponding parameters in the Component Inspector: forwardButton, backwardButton, scrollButton, scrollbarBackground.

ScrollBar Pro can be accessed from Components panel under UI Pro Components – jumpEYE.

Properties in the Parameters Panel

horizontalScroll – sets the scrollbar for horizontal or vertical scrolling – default is “false”
target - the target clip that needs to be scrolled

Properties in the Component Inspector

keepScrollButtonSize - if "true", keeps the scroll button at the same size (the size from the library) regardless of the scroll area and the target clip size – default is “false”

backwardButton - the linkage id of clip from the library used as the component's up or left button (if you would like to customize the look of the component)

forwardButton - the linkage id of clip from the library used as the component's down or right button (if you would like to customize the look of the component)

scrollbarBackground - the linkage id of clip from the library used as the component's background (if you would like to customize the look of the component)

scrollButton - the linkage id of clip from the library used as the component's scroll button (if you would like to customize the look of the component)

Methods

setBounds(width:Number, height:Number) - sets the size of the scroll area in which the target clip will be scrolled; by default, the height of the scroll area is the same with the vertical scroll bar's height and the scroll area's width is the same with the vertical scroll bar's width parameters:
- width:Number – the new width for the scroll area
- height:Number – the new height for the component

setSize(newWidth:Number, newHeight:Number) - sets the size of the scrollbar parameters:
- newWidth:Number – the new width for the component
- newHeight:Number – the new height for the component

refresh() - redraws the scroll bar

updateScrollBarPos() - updates the position of the scroll button after the target clip has moved

Code Samples

// create the two scroll bars
this.attachMovie("ScrollBar", "vertical_sc", this.getNextHighestDepth());
this.attachMovie("ScrollBar", "horizontal_sc", this.getNextHighestDepth());
// set the position and size for the two scroll bars
vertical_sc._x = 269;
vertical_sc._y = 18;
vertical_sc.setSize(15, 250);
horizontal_sc._x = 18;
horizontal_sc._y = 269;
horizontal_sc.setSize(250, 15);
// set the size of the scroll area
vertical_sc.setBounds(250, 250);
horizontal_sc.setBounds(250, 250);
// set the horizontal and vertical scroll bars
vertical_sc.horizontalScroll = false; // this is default anyway
horizontal_sc.horizontalScroll = true;
// set the target clip to be scrolled
vertical_sc.target = textClip_mc;
horizontal_sc.target = textClip_mc;