Package | fl.controls |
Class | public class UIScrollBar |
Inheritance | UIScrollBar ScrollBar UIComponent Sprite DisplayObjectContainer InteractiveObject DisplayObject EventDispatcher Object |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
scrollTarget
property so it can be attached
to a TextField instance or a TLFTextField instance.
Note: When you use ActionScript to update properties of
the TextField or TLFTextField instance that affect the text layout, you must call the
update()
method on the UIScrollBar component instance to refresh its scroll
properties. Examples of text layout properties that belong to the TextField or TLFTextField
instance include width
, height
, and wordWrap
.
Property | Defined By | ||
---|---|---|---|
accessibilityImplementation : AccessibilityImplementation
The current accessibility implementation (AccessibilityImplementation)
for this InteractiveObject instance. | InteractiveObject | ||
accessibilityProperties : AccessibilityProperties
The current accessibility options for this display object. | DisplayObject | ||
alpha : Number
Indicates the alpha transparency value of the object specified. | DisplayObject | ||
blendMode : String
A value from the BlendMode class that specifies which blend mode to use. | DisplayObject | ||
blendShader : Shader [write-only]
Sets a shader that is used for blending the foreground and background. | DisplayObject | ||
buttonMode : Boolean
Specifies the button mode of this sprite. | Sprite | ||
cacheAsBitmap : Boolean
If set to true, Flash runtimes cache an internal bitmap representation of the
display object. | DisplayObject | ||
cacheAsBitmapMatrix : Matrix
If non-null, this Matrix object defines how a display object is rendered when
cacheAsBitmap is set to true. | DisplayObject | ||
constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | ||
contextMenu : NativeMenu
Specifies the context menu associated with this object. | InteractiveObject | ||
direction : String [override]
Gets or sets a value that indicates whether the scroll bar scrolls horizontally or vertically. | UIScrollBar | ||
doubleClickEnabled : Boolean
Specifies whether the object receives doubleClick events. | InteractiveObject | ||
dropTarget : DisplayObject [read-only]
Specifies the display object over which the sprite is being dragged, or on
which the sprite was dropped. | Sprite | ||
enabled : Boolean [override]
Gets or sets a Boolean value that indicates whether the scroll bar is enabled. | ScrollBar | ||
filters : Array
An indexed array that contains each filter object currently associated with the display object. | DisplayObject | ||
focusEnabled : Boolean
Gets or sets a Boolean value that indicates whether the component can receive focus
after the user clicks it. | UIComponent | ||
focusManager : IFocusManager
Gets or sets the FocusManager that controls focus for this component and its
peers. | UIComponent | ||
focusRect : Object
Specifies whether this object displays a focus rectangle. | InteractiveObject | ||
graphics : Graphics [read-only]
Specifies the Graphics object that belongs to this sprite where vector
drawing commands can occur. | Sprite | ||
height : Number [override]
Gets or sets the height of the component, in pixels. | ScrollBar | ||
hitArea : Sprite
Designates another sprite to serve as the hit area for a sprite. | Sprite | ||
lineScrollSize : Number
Gets or sets a value that represents the increment by which to scroll the page
when the scroll bar track is pressed. | ScrollBar | ||
loaderInfo : LoaderInfo [read-only]
Returns a LoaderInfo object containing information about loading the file
to which this display object belongs. | DisplayObject | ||
mask : DisplayObject
The calling display object is masked by the specified mask object. | DisplayObject | ||
maxScrollPosition : Number
Gets or sets a number that represents the maximum scroll position. | ScrollBar | ||
metaData : Object
Obtains the meta data object of the DisplayObject instance if meta data was stored alongside the
the instance of this DisplayObject in the SWF file through a PlaceObject4 tag. | DisplayObject | ||
minScrollPosition : Number
Gets or sets a number that represents the minimum scroll position. | ScrollBar | ||
mouseChildren : Boolean
Determines whether or not the children of the object are mouse, or user input device, enabled. | DisplayObjectContainer | ||
mouseEnabled : Boolean
Specifies whether this object receives mouse, or other user input, messages. | InteractiveObject | ||
mouseFocusEnabled : Boolean
Gets or sets a value that indicates whether the component can receive focus after
the user clicks it. | UIComponent | ||
mouseX : Number [read-only]
Indicates the x coordinate of the mouse or user input device position, in pixels. | DisplayObject | ||
mouseY : Number [read-only]
Indicates the y coordinate of the mouse or user input device position, in pixels. | DisplayObject | ||
name : String
Indicates the instance name of the DisplayObject. | DisplayObject | ||
needsSoftKeyboard : Boolean
Specifies whether a virtual keyboard (an on-screen, software keyboard) should display
when this InteractiveObject instance receives focus. | InteractiveObject | ||
numChildren : int [read-only]
Returns the number of children of this object. | DisplayObjectContainer | ||
opaqueBackground : Object
Specifies whether the display object is opaque with a certain background color. | DisplayObject | ||
pageScrollSize : Number
Gets or sets a value that represents the increment by which the page is scrolled
when the scroll bar track is pressed. | ScrollBar | ||
pageSize : Number
Gets or sets the number of lines that a page contains. | ScrollBar | ||
parent : DisplayObjectContainer [read-only]
Indicates the DisplayObjectContainer object that contains this display object. | DisplayObject | ||
root : DisplayObject [read-only]
For a display object in a loaded SWF file, the root property is the
top-most display object in the portion of the display list's tree structure represented by that SWF file. | DisplayObject | ||
rotation : Number
Indicates the rotation of the DisplayObject instance, in degrees, from its original orientation. | DisplayObject | ||
rotationX : Number
Indicates the x-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rotationY : Number
Indicates the y-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
rotationZ : Number
Indicates the z-axis rotation of the DisplayObject instance, in degrees, from its original orientation relative to the 3D parent container. | DisplayObject | ||
scale9Grid : Rectangle
The current scaling grid that is in effect. | DisplayObject | ||
scaleX : Number [override]
Multiplies the current width of the component by a scale factor. | UIComponent | ||
scaleY : Number [override]
Multiplies the current height of the component by a scale factor. | UIComponent | ||
scaleZ : Number
Indicates the depth scale (percentage) of an object as applied from the registration point of the object. | DisplayObject | ||
scrollPosition : Number
Gets or sets the current scroll position and updates the position
of the thumb. | ScrollBar | ||
scrollRect : Rectangle
The scroll rectangle bounds of the display object. | DisplayObject | ||
scrollTarget : DisplayObject
Registers a TextField instance or a TLFTextField instance with the ScrollBar component instance. | UIScrollBar | ||
softKeyboard : String
Controls the appearance of the soft keyboard. | InteractiveObject | ||
softKeyboardInputAreaOfInterest : Rectangle
Defines the area that should remain on-screen when a soft keyboard is displayed (not available on iOS). | InteractiveObject | ||
soundTransform : flash.media:SoundTransform
Controls sound within this sprite. | Sprite | ||
stage : Stage [read-only]
The Stage of the display object. | DisplayObject | ||
tabChildren : Boolean
Determines whether the children of the object are tab enabled. | DisplayObjectContainer | ||
tabEnabled : Boolean
Specifies whether this object is in the tab order. | InteractiveObject | ||
tabIndex : int
Specifies the tab ordering of objects in a SWF file. | InteractiveObject | ||
textSnapshot : flash.text:TextSnapshot [read-only]
Returns a TextSnapshot object for this DisplayObjectContainer instance. | DisplayObjectContainer | ||
transform : flash.geom:Transform
An object with properties pertaining to a display object's matrix, color transform, and pixel bounds. | DisplayObject | ||
useHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the pointer rolls
over a sprite in which the buttonMode property is set to true. | Sprite | ||
visible : Boolean [override]
Gets or sets a value that indicates whether the current component instance is visible. | UIComponent | ||
width : Number [override]
Gets or sets the width of the component, in pixels. | ScrollBar | ||
x : Number [override]
Gets or sets the x coordinate that represents the position of the component along
the x axis within its parent container. | UIComponent | ||
y : Number [override]
Gets or sets the y coordinate that represents the position of the component along
the y axis within its parent container. | UIComponent | ||
z : Number
Indicates the z coordinate position along the z-axis of the DisplayObject
instance relative to the 3D parent container. | DisplayObject |
Method | Defined By | ||
---|---|---|---|
Creates a new UIScrollBar component instance. | UIScrollBar | ||
Adds a child DisplayObject instance to this DisplayObjectContainer instance. | DisplayObjectContainer | ||
Adds a child DisplayObject instance to this DisplayObjectContainer
instance. | DisplayObjectContainer | ||
addEventListener(type:String, listener:Function, useCapture:Boolean = false, priority:int = 0, useWeakReference:Boolean = false):void
Registers an event listener object with an EventDispatcher object so that the listener
receives notification of an event. | EventDispatcher | ||
Indicates whether the security restrictions
would cause any display objects to be omitted from the list returned by calling
the DisplayObjectContainer.getObjectsUnderPoint() method
with the specified point point. | DisplayObjectContainer | ||
Deletes a style property from this component instance. | UIComponent | ||
Determines whether the specified display object is a child of the DisplayObjectContainer instance or
the instance itself. | DisplayObjectContainer | ||
Dispatches an event into the event flow. | EventDispatcher | ||
Shows or hides the focus indicator on this component. | UIComponent | ||
Initiates an immediate draw operation, without invalidating everything as invalidateNow does. | UIComponent | ||
Returns a rectangle that defines the area of the display object relative to the coordinate system
of the targetCoordinateSpace object. | DisplayObject | ||
Returns the child display object instance that exists at the specified index. | DisplayObjectContainer | ||
Returns the child display object that exists with the specified name. | DisplayObjectContainer | ||
Returns the index position of a child DisplayObject instance. | DisplayObjectContainer | ||
Retrieves the object that currently has focus. | UIComponent | ||
Returns an array of objects that lie under the specified point and are children
(or grandchildren, and so on) of this DisplayObjectContainer instance. | DisplayObjectContainer | ||
Returns a rectangle that defines the boundary of the display object,
based on the coordinate system defined by the targetCoordinateSpace
parameter, excluding any strokes on shapes. | DisplayObject | ||
Retrieves a style property that is set in the style lookup
chain of the component. | UIComponent | ||
[static]
Retrieves the default style map for the current component. | UIScrollBar | ||
Converts the point object from the Stage (global) coordinates
to the display object's (local) coordinates. | DisplayObject | ||
Converts a two-dimensional point from the Stage (global) coordinates to a
three-dimensional display object's (local) coordinates. | DisplayObject | ||
Checks whether the EventDispatcher object has any listeners registered for a specific type
of event. | EventDispatcher | ||
Indicates whether an object has a specified property defined. | Object | ||
Evaluates the bounding box of the display object to see if it overlaps or intersects with the
bounding box of the obj display object. | DisplayObject | ||
Evaluates the display object to see if it overlaps or intersects with the
point specified by the x and y parameters. | DisplayObject | ||
Marks a property as invalid and redraws the component on the
next frame unless otherwise specified. | UIComponent | ||
Indicates whether an instance of the Object class is in the prototype chain of the object specified
as the parameter. | Object | ||
Converts a three-dimensional point of the three-dimensional display
object's (local) coordinates to a two-dimensional point in the Stage (global) coordinates. | DisplayObject | ||
Converts the point object from the display object's (local) coordinates to the
Stage (global) coordinates. | DisplayObject | ||
[static]
Merges the styles from multiple classes into one object. | UIComponent | ||
Moves the component to the specified position within its parent. | UIComponent | ||
Indicates whether the specified property exists and is enumerable. | Object | ||
Removes the specified child DisplayObject instance from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | ||
Removes a child DisplayObject from the specified index position in the child list of
the DisplayObjectContainer. | DisplayObjectContainer | ||
Removes all child DisplayObject instances from the child list of the DisplayObjectContainer instance. | DisplayObjectContainer | ||
Removes a listener from the EventDispatcher object. | EventDispatcher | ||
Raises a virtual keyboard. | InteractiveObject | ||
Changes the position of an existing child in the display object container. | DisplayObjectContainer | ||
Sets the focus to this component. | UIComponent | ||
Sets the availability of a dynamic property for loop operations. | Object | ||
setScrollProperties(pageSize:Number, minScrollPosition:Number, maxScrollPosition:Number, pageScrollSize:Number = 0):void [override]
Sets the range and viewport size of the ScrollBar component. | UIScrollBar | ||
[override]
Sets the component to the specified width and height. | ScrollBar | ||
Sets a style property on this component instance. | UIComponent | ||
Lets the user drag the specified sprite. | Sprite | ||
Lets the user drag the specified sprite on a touch-enabled device. | Sprite | ||
Recursively stops the timeline execution of all MovieClips rooted at this object. | DisplayObjectContainer | ||
Ends the startDrag() method. | Sprite | ||
Ends the startTouchDrag() method, for use with touch-enabled devices. | Sprite | ||
Swaps the z-order (front-to-back order) of the two specified child objects. | DisplayObjectContainer | ||
Swaps the z-order (front-to-back order) of the child objects at the two specified index positions in the
child list. | DisplayObjectContainer | ||
Returns the string representation of this object, formatted according to locale-specific conventions. | Object | ||
Returns the string representation of the specified object. | Object | ||
Forces the scroll bar to update its scroll properties immediately. | UIScrollBar | ||
Validates and updates the properties and layout of this object, redrawing it
if necessary. | UIComponent | ||
Returns the primitive value of the specified object. | Object | ||
Checks whether an event listener is registered with this EventDispatcher object or any of
its ancestors for the specified event type. | EventDispatcher |
Styles are either common or associated with a specific theme. If the style is common, it can be used with any theme. If a style is associated with a specific theme, it can only be used if your application uses that theme.
direction | property |
direction:String
[override] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets a value that indicates whether the scroll bar scrolls horizontally or vertically.
Valid values are ScrollBarDirection.HORIZONTAL
and
ScrollBarDirection.VERTICAL
.
The default value is ScrollBarDirection.VERTICAL.
Implementation
override public function get direction():String
override public function set direction(value:String):void
Related API Elements
Example ( How to use this example )
import fl.controls.UIScrollBar; import fl.controls.ScrollBarDirection; var url:String = "http://www.helpexamples.com/flash/text/lorem.txt"; var uLdr:URLLoader = new URLLoader(new URLRequest(url)); uLdr.addEventListener(Event.COMPLETE, completeHandler); var tf:TextField = new TextField(); tf.width = 320; tf.height = 140; tf.x = 10; tf.y = 10; tf.border = true; tf.multiline = true; tf.wordWrap = false; addChild(tf) var hScrollBar:UIScrollBar = new UIScrollBar(); hScrollBar.direction = ScrollBarDirection.HORIZONTAL; hScrollBar.move(tf.x, tf.y + tf.height); hScrollBar.width = tf.width; hScrollBar.scrollTarget = tf; addChild(hScrollBar); var vScrollBar:UIScrollBar = new UIScrollBar(); vScrollBar.direction = ScrollBarDirection.VERTICAL; vScrollBar.move(tf.x + tf.width, tf.y); vScrollBar.height = tf.height; vScrollBar.scrollTarget = tf; addChild(vScrollBar); function completeHandler(event:Event):void { tf.text = event.target.data; hScrollBar.update(); vScrollBar.update(); }
import fl.controls.ScrollBarDirection; import fl.controls.UIScrollBar; var myTextField:TextField = new TextField(); myTextField.width = 160; myTextField.height = 120; myTextField.border = true; myTextField.x = 10; myTextField.y = 10; addChild(myTextField); var hScrollBar:UIScrollBar = new UIScrollBar(); hScrollBar.direction = ScrollBarDirection.HORIZONTAL; hScrollBar.scrollTarget = myTextField; hScrollBar.width = myTextField.width; hScrollBar.move(myTextField.x, myTextField.y + myTextField.height); addChild(hScrollBar); var myURLLoader:URLLoader = new URLLoader(); myURLLoader.addEventListener(Event.COMPLETE, completeHandler); myURLLoader.load(new URLRequest("http://www.helpexamples.com/flash/lorem.txt")); function completeHandler(event:Event):void { var txt:String = URLLoader(event.currentTarget).data as String; myTextField.text = txt; vScrollBar.update(); }
scrollTarget | property |
scrollTarget:DisplayObject
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Registers a TextField instance or a TLFTextField instance with the ScrollBar component instance.
Implementation
public function get scrollTarget():DisplayObject
public function set scrollTarget(value:DisplayObject):void
Related API Elements
Example ( How to use this example )
scrollTarget
property:
import fl.controls.UIScrollBar; var url:String = "http://www.helpexamples.com/flash/text/lorem.txt"; var tf:TextField = new TextField(); tf.x = 10; tf.y = 10; tf.width = 500; tf.height = 380; tf.wordWrap = true; addChild(tf); var myScrollBar:UIScrollBar = new UIScrollBar(); myScrollBar.move(tf.x + tf.width, tf.y); myScrollBar.height = tf.height; myScrollBar.scrollTarget = tf; addChild(myScrollBar); var uLdr:URLLoader = new URLLoader(); uLdr.addEventListener(Event.COMPLETE, completeHandler); uLdr.load(new URLRequest(url)); function completeHandler(event:Event):void { tf.text = URLLoader(event.target).data; myScrollBar.update(); }
UIScrollBar | () | Constructor |
public function UIScrollBar()
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates a new UIScrollBar component instance.
getStyleDefinition | () | method |
public static function getStyleDefinition():Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Retrieves the default style map for the current component. The style map contains
the type that is appropriate for the component, depending on the style that
the component uses. For example, the disabledTextFormat
style
contains a value of null
or a TextFormat object.
You can use these styles and call setStyle()
on the current
component. The following code overrides the default disabledTextFormat
style on the specified component:
componentInstance.setStyle("disabledTextFormat", new TextFormat());
Object — Default styles object.
|
Related API Elements
setScrollProperties | () | method |
override public function setScrollProperties(pageSize:Number, minScrollPosition:Number, maxScrollPosition:Number, pageScrollSize:Number = 0):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Sets the range and viewport size of the ScrollBar component. The ScrollBar
component updates the state of the arrow buttons and size of the scroll
thumb accordingly. All of the scroll properties are relative to the
scale of the minScrollPosition
and the maxScrollPosition
.
Each number between the maximum and minumum values represents one scroll position.
Parameters
pageSize:Number — Size of one page. Determines the size of the thumb, and the increment by which the scroll bar moves when the arrows are clicked.
| |
minScrollPosition:Number — Bottom of the scrolling range.
| |
maxScrollPosition:Number — Top of the scrolling range.
| |
pageScrollSize:Number (default = 0 ) — Increment to move when a track is pressed, in pixels.
|
Related API Elements
update | () | method |
public function update():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Forces the scroll bar to update its scroll properties immediately.
This is necessary after text in the specified scrollTarget
text field
is added using ActionScript, and the scroll bar needs to be refreshed.
Related API Elements
Example ( How to use this example )
import fl.controls.UIScrollBar; var myTextField:TextField = new TextField(); myTextField.wordWrap = true; myTextField.width = 160; myTextField.height = 120; myTextField.border = true; myTextField.x = 10; myTextField.y = 10; addChild(myTextField); var vScrollBar:UIScrollBar = new UIScrollBar(); vScrollBar.scrollTarget = myTextField; vScrollBar.height = myTextField.height; vScrollBar.move(myTextField.x + myTextField.width, myTextField.y); addChild(vScrollBar); var myURLLoader:URLLoader = new URLLoader(); myURLLoader.addEventListener(Event.COMPLETE, completeHandler); myURLLoader.load(new URLRequest("http://www.helpexamples.com/flash/lorem.txt")); function completeHandler(event:Event):void { var txt:String = URLLoader(event.currentTarget).data as String; myTextField.text = txt; vScrollBar.update(); }
To run the example, follow these steps:
- Add the UIScrollBar component to the library.
- Save this code as UIScrollBarExample.as in the same directory as your FLA file.
- Set the Document class in the FLA file to UIScrollBarExample.
package { import fl.controls.UIScrollBar; import flash.display.Sprite; import flash.text.TextField; public class UIScrollBarExample extends Sprite { private var tf:TextField; private var sb:UIScrollBar = new UIScrollBar(); private var sampleText:String = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Phasellus vestibulum. Praesent in velit. Fusce scelerisque. Nullam fringilla. Aenean ut lacus at mi rutrum elementum. Suspendisse sit amet ligula et ipsum rhoncus sagittis. Aenean quis lacus. Nullam quis lorem. Integer pellentesque dictum lorem. In hendrerit lectus non orci. Sed vestibulum. Maecenas ornare, libero eu laoreet tristique, felis odio tincidunt nibh, et faucibus nibh tellus at metus. In hac habitasse platea dictumst. Nullam aliquam, dolor ut commodo dictum, ante justo dictum nisi, id suscipit elit sapien nec pede." public function UIScrollBarExample() { createTextField(); assignScrollBar(); } private function createTextField():void { tf = new TextField(); tf.width = 200; tf.height = 100; tf.wordWrap = true; tf.multiline = true; tf.border = true; tf.text = sampleText; addChild(tf); } private function assignScrollBar():void { sb = new UIScrollBar(); sb.move(tf.x + tf.width, tf.y); sb.setSize(sb.width, tf.height); sb.scrollTarget = tf; addChild(sb); } } }
Thu Dec 6 2018, 01:12 PM -08:00