| Methods | Properties | Effects | Events | Styles | Frames | No Frames |
Direct Known Subclasses![]()
The ScrollView class is the base class for controls with scroll bars and a mask. The user interacts with the scroll bar or the developer accesses methods and properties that alter the viewable area. Unlike a View container, which can have multiple children, the ScrollView takes a single child object and positions and masks that object to display the viewable content. All items to be scrolled must be children of that content object. The content object must derive from UIObject or at least support the setSize() and move() methods.
MXML Syntax
The ScrollView class has the following properties:
<mx:tagname
hPosition="0"
hScrollPolicy="off|on|auto"
liveScrolling="false|true"
maxHPosition="No default.
maxVPosition="No default.
scrollTipFunction="No default.
showScrollTips="false|true"
vPosition="0"
vScrollPolicy="auto|off|on"
/>
| Methods | |
| childLoaded(
obj:
MovieClip)
:
VoidScrollView's version of the childLoaded() method also creates a mask. |
| createChildren(
)
:
VoidCreates objects that are children of this ScrollView, which in this case are the border and mask. |
| createChildWithStyles(
classOrSymbol, name:
String, props:
Object, inheritingStyleSheet:
mx.styles.CSSStyleSheet, nonInheritingStyleSheet:
mx.styles.CSSStyleSheet)
:
MovieClipCreates the content object. |
| getViewMetrics(
)
:
ObjectReturns the ViewMetrics taking into account the scroll bars, if visible. |
| init(
)
:
VoidInitializes variables and establishes MouseWheel support. |
| layoutChildren(
)
:
VoidSets the position and size of the scroll bars and content and adjusts the mask. |
| setScrollProperties(
colCount:
Number, colWidth:
Number, rwCount:
Number, rwHeight:
Number, hPadding:
Number, wPadding:
Number)
:
VoidInforms the ScrollView as to aspects of the content so that it can set up scroll bars as needed. |
| Methods inherited from class mx.core.UIComponent |
drawFocus
getFocus
getFocusManager
setEnabled
setFocus
|
| Properties | |
| className:
StringName of this class. |
| hPosition:
NumberThe left-most pixel of the content that is displayed in the upper left corner of the ScrollView control. |
| hScrollPolicy:
StringWhether the horizontal scroll bar is always on, always off, or automatically changes based on the parameters passed to the setScrollProperties() method. |
| liveScrolling:
BooleanDetermines whether scrolling is "live" as the thumb is moved or the view is not updated until the thumb is released. |
| maxHPosition:
NumberMaximum value for hPosition. |
| maxVPosition:
Number
[Read-Only]
Maximum value for vPosition. |
| scrollTipFunction:
FunctionThis function is called if the showScrollTips property is set to true and the scroll thumb is being dragged and should return the String that should be used as a ScrollTip. |
| showScrollTips:
BooleanDetermines whether a tooltip should appear near the scroll thumb when it is being dragged. |
static | version:
StringVersion string for this class. |
| vPosition:
NumberThe top-most pixel of the content that is displayed in the upper left corner of the ScrollView control. |
| vScrollPolicy:
StringWhether the horizontal scroll bar is always on, always off, or automatically changes based on the parameters passed to the setScrollProperties() method. |
| Properties inherited from class mx.core.View |
baselinePosition
className
numChildren
version
|
| Properties inherited from class mx.core.UIComponent |
enabled
errorString
tabEnabled
tabIndex
version
|
| Effects |
| Effects inherited from class mx.core.UIComponent |
focusInEffect
focusOutEffect
|
| Effects inherited from class mx.core.UIObject |
creationCompleteEffect
hideEffect
mouseDownEffect
mouseOutEffect
mouseOverEffect
mouseUpEffect
moveEffect
resizeEffect
showEffect
|
| Events | |
scroll | Broadcast when the content is scrolled. The event object contains the following properties: - direction Either vertical or horizontal.- position Original position.- delta Change in position.- target Reference to the component that triggered the event. - type The name of the event, scroll. |
| Events inherited from class: mx.core.View |
childCreated childDestroyed childIndexChanged |
| Events inherited from class: mx.core.UIComponent |
focusIn focusOut invalid keyDown keyUp valid valueCommitted |
| Styles |
| Styles inherited from class mx.core.UIObject |
color
fontFamily
fontSize
fontStyle
fontWeight
horizontalGap
leading
marginLeft
marginRight
textAlign
textDecoration
textIndent
verticalGap
|
| Method Detail |
childLoaded(
obj:
MovieClip)
:
Void
childLoaded() method also creates a mask.
Parameters
obj:
MovieClip - The loaded child
See Also
View
createChildren(
)
:
Void
super.createChildren() method so that the logic in the ScrollView.createChildren() method is executed.
createChildWithStyles(
classOrSymbol, name:
String, props:
Object, inheritingStyleSheet:
mx.styles.CSSStyleSheet, nonInheritingStyleSheet:
mx.styles.CSSStyleSheet)
:
MovieClip
Note: Unlike the View.createChild() method, only one child is allowed in a the ScrollView class. Subsequent calls to createChild() simply delete the old child and replace it with the new one.
Parameters
classOrSymbol - Reference to a class, the linkage ID of a symbol, or file path or URL to the external content. Specify the class name without using double quotation marks; do not specify the component as a String.
name:
String - Instance name of the child.
props:
Object - Object that contains initialization properties.
inheritingStyleSheet:
mx.styles.CSSStyleSheet - CSSStyleSheet that contains the inheriting styles to be initialized.
nonInheritingStyleSheet:
mx.styles.CSSStyleSheet - CSSStyleSheet that contains the non-inheriting styles to be initialized.
See Also
View
getViewMetrics(
)
:
Object
Returns
Object with the left, right, top and bottom edges' thickness, in pixels.
See Also
View
init(
)
:
Void
super.init() method, so that the logic in ScrollView.init gets executed.
layoutChildren(
)
:
Void
See Also
View
setScrollProperties(
colCount:
Number, colWidth:
Number, rwCount:
Number, rwHeight:
Number, hPadding:
Number, wPadding:
Number)
:
Void
There are three common uses cases: if the content consists of a set of rows and columns like in a List or DataGrid control, and all columns have the same width and all rows have the same height, set the parameters as follows:
colCount = total number of columns that might be displayedcolWidth = pixel width of the columnsrwCount = total number of rowsrwHeight = pixel height of a rowcolCount = sum of all column widthscolWidth = 1rwCount = total number of rowsrwHeight = pixel height of a rowcolCount = width of the contentcolWidth = 1rwCount = height of the contentrwHeight = 1rowHeight or columnWidth to 1, you should set the lineScrollSize of hScroller and/or vScroller, so they scroll in more than 1-pixel increments with each arrow button click.
Parameters
colCount:
Number - Number of units to scroll horizontally.
colWidth:
Number - Width in pixels of each of those units.
rwCount:
Number - Number of units to scroll vertically.
rwHeight:
Number - Height in pixels of each of those units.
hPadding:
Number - Pixels on the left edge that are not scrolled (for row headers).
wPadding:
Number - Pixels on the top edge that are not scrolled (for column headers).
| Property Detail |
className:
String
hPosition:
Number
hScrollPolicy:
String
setScrollProperties() method. Allowed values are on, off, auto. The default value is off.
liveScrolling:
Boolean
true.
maxHPosition:
Number
hPosition. Note that this is not the width of the content because the maxHPosition is the width of the content minus the width of the displayable area.
maxVPosition:
Number
[Read-Only]
vPosition. Note that this is not the height of the content because the maxVPosition is the height of the content minus the height of the displayable area.
scrollTipFunction:
Function
showScrollTips property is set to true and the scroll thumb is being dragged and should return the String that should be used as a ScrollTip. The function is passed two parameters. the first is the direction of the scroll bar. The second is its scrollPosition. E.g.,function scrollTipFunction(direction:String, position:Number) : String
{
if (direction == "vertical") return myToolTips[position];
else return "";
}
showScrollTips:
Boolean
false
static
version:
String
vPosition:
Number
vScrollPolicy:
String
setScrollProperties() method. Allowed values are on, off, auto. The default value is auto.
RSS feed | Send me an e-mail when comments are added to this page | Comment Report
Current page: http://livedocs.adobe.com/flex/15/asdocs_en/mx/core/ScrollView.html
Comments
alon said on Nov 28, 2005 at 2:38 PM : smgilson said on Nov 30, 2005 at 2:09 PM :