Package | fl.containers |
Class | public class ScrollPane |
Inheritance | ScrollPane ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
Implements | IFocusManagerComponent |
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Note: When content is being loaded from a different domain or sandbox, the properties of the content may be inaccessible for security reasons. For more information about how domain security affects the load process, see the Loader class.
Note: When loading very large image files into a ScrollPane object,
it may be necessary to listen for the complete
event and then resize the
ScrollPane using the setSize()
method. See the complete
event example.
See also
Property | Defined By | ||
---|---|---|---|
![]() | 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 | |
bytesLoaded : Number [read-only]
Gets the count of bytes of content that have been loaded. | ScrollPane | ||
bytesTotal : Number [read-only]
Gets the count of bytes of content to be loaded. | ScrollPane | ||
![]() | cacheAsBitmap : Boolean
If set to true, Flash Player or Adobe AIR caches an internal bitmap representation of the
display object. | DisplayObject | |
![]() | constructor : Object
A reference to the class object or constructor function for a given object instance. | Object | |
content : DisplayObject [read-only]
Gets a reference to the content loaded into the scroll pane. | ScrollPane | ||
![]() | contextMenu : NativeMenu
Specifies the context menu associated with this object. | InteractiveObject | |
![]() | 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
Gets or sets a value that indicates whether the component can accept user interaction. | UIComponent | |
![]() | 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. | UIComponent | |
![]() | hitArea : Sprite
Designates another sprite to serve as the hit area for a sprite. | Sprite | |
![]() | horizontalLineScrollSize : Number
Gets or sets a value that describes the amount of content to be scrolled,
horizontally, when a scroll arrow is clicked. | BaseScrollPane | |
![]() | horizontalPageScrollSize : Number
Gets or sets the count of pixels by which to move the scroll thumb
on the horizontal scroll bar when the scroll bar track is pressed. | BaseScrollPane | |
![]() | horizontalScrollBar : ScrollBar [read-only]
Gets a reference to the horizontal scroll bar. | BaseScrollPane | |
![]() | horizontalScrollPolicy : String
Gets or sets a value that indicates the state of the horizontal scroll
bar. | BaseScrollPane | |
![]() | horizontalScrollPosition : Number
Gets or sets a value that describes the horizontal position of the
horizontal scroll bar in the scroll pane, in pixels. | BaseScrollPane | |
![]() | 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 | |
![]() | maxHorizontalScrollPosition : Number [read-only]
Gets the maximum horizontal scroll position for the current content, in pixels. | BaseScrollPane | |
![]() | maxVerticalScrollPosition : Number [read-only]
Gets the maximum vertical scroll position for the current content, in pixels. | BaseScrollPane | |
![]() | mouseChildren : Boolean
Determines whether or not the children of the object are mouse enabled. | DisplayObjectContainer | |
![]() | mouseEnabled : Boolean
Specifies whether this object receives mouse 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 position, in pixels. | DisplayObject | |
![]() | mouseY : Number [read-only]
Indicates the y coordinate of the mouse position, in pixels. | DisplayObject | |
![]() | name : String
Indicates the instance name of the DisplayObject. | DisplayObject | |
![]() | 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 | |
![]() | parent : DisplayObjectContainer [read-only]
Indicates the DisplayObjectContainer object that contains this display object. | DisplayObject | |
percentLoaded : Number [read-only]
Gets a number between 0 and 100 indicating what percentage of the content is loaded. | ScrollPane | ||
![]() | prototype : Object [static]
A reference to the prototype object of a class or function object. | Object | |
![]() | 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 | |
scrollDrag : Boolean
Gets or sets a value that indicates whether scrolling occurs when a
user drags on content within the scroll pane. | ScrollPane | ||
![]() | scrollRect : Rectangle
The scroll rectangle bounds of the display object. | DisplayObject | |
![]() | soundTransform : flash.media:SoundTransform
Controls sound within this sprite. | Sprite | |
source : Object
Gets or sets an absolute or relative URL that identifies the
location of the SWF or image file to load, the class name
of a movie clip in the library, a reference to a display object,
or a instance name of a movie clip on the same level as the component. | ScrollPane | ||
![]() | 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 | |
![]() | useBitmapScrolling : Boolean
When set to true, the cacheAsBitmap property for the scrolling content is set
to true; when set to false this value is turned off. | BaseScrollPane | |
![]() | useHandCursor : Boolean
A Boolean value that indicates whether the pointing hand (hand cursor) appears when the mouse rolls
over a sprite in which the buttonMode property is set to true. | Sprite | |
![]() | version : String = "3.0.0.16"
The version number of the components. | UIComponent | |
![]() | verticalLineScrollSize : Number
Gets or sets a value that describes how many pixels to scroll vertically when a scroll arrow is clicked. | BaseScrollPane | |
![]() | verticalPageScrollSize : Number
Gets or sets the count of pixels by which to move the scroll thumb
on the vertical scroll bar when the scroll bar track is pressed. | BaseScrollPane | |
![]() | verticalScrollBar : ScrollBar [read-only]
Gets a reference to the vertical scroll bar. | BaseScrollPane | |
![]() | verticalScrollPolicy : String
Gets or sets a value that indicates the state of the vertical scroll
bar. | BaseScrollPane | |
![]() | verticalScrollPosition : Number
Gets or sets a value that describes the vertical position of the
vertical scroll bar in the scroll pane, in pixels. | BaseScrollPane | |
![]() | 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. | UIComponent | |
![]() | 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 ScrollPane component instance. | ScrollPane | ||
![]() |
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. | ScrollPane | ||
![]() |
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 | |
The request parameter of this method accepts only a URLRequest object
whose source property contains a string, a class, or a
URLRequest object. | ScrollPane | ||
![]() |
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 | |
Reloads the contents of the scroll pane. | ScrollPane | ||
![]() |
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 a listener from the EventDispatcher object. | EventDispatcher | |
![]() |
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 | |
![]() |
Sets the component to the specified width and height. | UIComponent | |
![]() |
Sets a style property on this component instance. | UIComponent | |
![]() |
Lets the user drag the specified sprite. | Sprite | |
![]() |
Ends the startDrag() method. | 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 | |
Refreshes the scroll bar properties based on the width
and height of the content. | ScrollPane | ||
![]() |
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 |
Event | Summary | Defined By | ||
---|---|---|---|---|
![]() | [broadcast event] Dispatched when the Flash Player or AIR application gains operating system focus and becomes active. | EventDispatcher | ||
![]() | Dispatched when a display object is added to the display list. | DisplayObject | ||
![]() | Dispatched when a display object is added to the on stage display list, either directly or through the addition of a sub tree in which the display object is contained. | DisplayObject | ||
![]() | Dispatched when the user selects 'Clear' (or 'Delete') from the text context menu. | InteractiveObject | ||
![]() | Dispatched when a user presses and releases the main button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
Dispatched when content has finished loading. | ScrollPane | |||
![]() | Dispatched when a user gesture triggers the context menu associated with this interactive object in an AIR application. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform specific accelerator key combination for a copy operation or selects 'Copy' from the text context menu. | InteractiveObject | ||
![]() | Dispatched when the user activates the platform specific accelerator key combination for a cut operation or selects 'Cut' from the text context menu. | InteractiveObject | ||
![]() | [broadcast event] Dispatched when the Flash Player or AIR application operating loses system focus and is becoming inactive. | EventDispatcher | ||
![]() | Dispatched when a user presses and releases the main button of a pointing device twice in rapid succession over the same InteractiveObject when that object's doubleClickEnabled flag is set to true. | InteractiveObject | ||
![]() | [broadcast event] Dispatched when the playhead is entering a new frame. | DisplayObject | ||
![]() | [broadcast event] Dispatched when the playhead is exiting the current frame. | DisplayObject | ||
![]() | Dispatched after a display object gains focus. | InteractiveObject | ||
![]() | Dispatched after a display object loses focus. | InteractiveObject | ||
![]() | [broadcast event] Dispatched after the constructors of frame display objects have run but before frame scripts have run. | DisplayObject | ||
![]() | Dispatched after the component visibility changes from visible to invisible. | UIComponent | ||
Dispatched when the properties and methods of a loaded SWF file are accessible. | ScrollPane | |||
Dispatched after an input or output error occurs. | ScrollPane | |||
![]() | Dispatched when the user presses a key. | InteractiveObject | ||
![]() | Dispatched when the user attempts to change focus by using keyboard navigation. | InteractiveObject | ||
![]() | Dispatched when the user releases a key. | InteractiveObject | ||
![]() | Dispatched when a user presses and releases the middle button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user presses the middle pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user attempts to change focus by using a pointer device. | InteractiveObject | ||
![]() | Dispatched when a user moves the pointing device while it is over an InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a mouse wheel is spun over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched after the component is moved. | UIComponent | ||
![]() | Dispatched by the drag initiator InteractiveObject when the user releases the drag gesture. | InteractiveObject | ||
![]() | Dispatched by the target InteractiveObject when a dragged object is dropped on it and the drop has been accepted with a call to DragManager.acceptDragDrop(). | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject when a drag gesture enters its boundary. | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject when a drag gesture leaves its boundary. | InteractiveObject | ||
![]() | Dispatched by an InteractiveObject continually while a drag gesture remains within its boundary. | InteractiveObject | ||
![]() | Dispatched at the beginning of a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | ||
![]() | Dispatched during a drag operation by the InteractiveObject that is specified as the drag initiator in the DragManager.doDrag() call. | InteractiveObject | ||
Dispatched after a network operation starts. | ScrollPane | |||
![]() | Dispatched when the user activates the platform specific accelerator key combination for a paste operation or selects 'Paste' from the text context menu. | InteractiveObject | ||
Dispatched while content is loading. | ScrollPane | |||
![]() | Dispatched when a display object is about to be removed from the display list. | DisplayObject | ||
![]() | Dispatched when a display object is about to be removed from the display list, either directly or through the removal of a sub tree in which the display object is contained. | DisplayObject | ||
![]() | [broadcast event] Dispatched when the display list is about to be updated and rendered. | DisplayObject | ||
![]() | Dispatched after the component is resized. | UIComponent | ||
![]() | Dispatched when a user presses and releases the right button of the user's pointing device over the same InteractiveObject. | InteractiveObject | ||
![]() | Dispatched when a user presses the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when a user releases the pointing device button over an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device away from an InteractiveObject instance. | InteractiveObject | ||
![]() | Dispatched when the user moves a pointing device over an InteractiveObject instance. | InteractiveObject | ||
Defines the value of the type property of a scroll event object. | ScrollPane | |||
Dispatched after a security error occurs while content is loading. | ScrollPane | |||
![]() | Dispatched when the user activates the platform specific accelerator key combination for a select all operation or selects 'Select All' from the text context menu. | InteractiveObject | ||
![]() | Dispatched after the component visibility changes from invisible to visible. | UIComponent | ||
![]() | Dispatched when the value of the object's tabChildren flag changes. | InteractiveObject | ||
![]() | Dispatched when the object's tabEnabled flag changes. | InteractiveObject | ||
![]() | Dispatched when the value of the object's tabIndex property changes. | InteractiveObject | ||
![]() | Dispatched when a user enters one or more characters of text. | InteractiveObject |
Style | Description | Defined By | ||
---|---|---|---|---|
contentPadding | Type: Number Format: Length The amount of padding to put around the content in the scroll pane, in pixels. The default value is 0 . | ScrollPane | ||
![]() | Type: Number Format: Length When the enabled property is set to false , interaction with the component is prevented and a white overlay is displayed over the component, dimming the component contents. | BaseScrollPane | ||
disabledSkin | Type: Class The skin that shows when the scroll pane is disabled. The default value is ScrollPane_disabledSkin . | ScrollPane | ||
![]() | Type: flash.text.TextFormat The TextFormat object to use to render the component label when the button is disabled. | UIComponent | ||
![]() | Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar when it is disabled. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar when you click the arrow button. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar when the mouse pointer is over the arrow button. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the down arrow button of the scroll bar. | BaseScrollPane | ||
![]() | Type: Number Format: Length The padding that separates the outside boundaries of the component from the outside edges of the focus indicator, in pixels. | UIComponent | ||
![]() | Type: Class The skin to be used to display focus indicators. | UIComponent | ||
![]() | Type: Number Format: Time The number of milliseconds to wait after the buttonDown event is first dispatched before sending a second buttonDown event. | BaseScrollPane | ||
![]() | Type: Number Format: Time The interval, in milliseconds, between buttonDown events that are dispatched after the delay that is specified by the repeatDelay style. | BaseScrollPane | ||
![]() | Type: Class The skin to be used as the background of the scroll pane. | BaseScrollPane | ||
![]() | Type: flash.text.TextFormat The TextFormat object to use to render the component label. | UIComponent | ||
![]() | Type: Class The skin that is used to indicate the disabled state of the thumb. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the thumb of the scroll bar when you click the thumb. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the icon for the thumb of the scroll bar. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the thumb of the scroll bar when the mouse pointer is over the thumb. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin used for the thumb of the scroll bar. | BaseScrollPane | ||
![]() | Type: Class The skin that is used to indicate a disabled track. | BaseScrollPane | ||
![]() | Type: Class The skin that is used to indicate the down state of a disabled skin. | BaseScrollPane | ||
![]() | Type: Class The skin that is used to indicate the mouseover state for the scroll track. | BaseScrollPane | ||
![]() | Type: Class The skin used to indicate the mouse up state for the scroll track. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar when it is disabled. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar when you click the arrow button. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar when the mouse pointer is over the arrow button. | BaseScrollPane | ||
![]() | Type: Class Name of the class to use as the skin for the up arrow button of the scroll bar. | BaseScrollPane | ||
upSkin | Type: Class The default skin shown on the scroll pane. The default value is ScrollPane_upSkin . | ScrollPane |
bytesLoaded | property |
bytesLoaded:Number
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets the count of bytes of content that have been loaded.
When this property equals the value of bytesTotal
,
all the bytes are loaded.
The default value is 0.
public function get bytesLoaded():Number
See also
import fl.containers.ScrollPane; import fl.controls.ProgressBar; var path:String = "test.jpg"; var sp:ScrollPane = new ScrollPane(); sp.move(10,10); sp.setSize(530,300); sp.addEventListener(ProgressEvent.PROGRESS,reportProgress); sp.load(new URLRequest(path)); addChild(sp); var progressBar:ProgressBar = new ProgressBar(); progressBar.move(10,320); progressBar.setSize(530,50); progressBar.source = sp; addChild(progressBar); function reportProgress(e:ProgressEvent):void { trace(e.bytesLoaded + " loaded out of " + e.bytesTotal); }
bytesTotal | property |
bytesTotal:Number
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets the count of bytes of content to be loaded.
The default value is 0.
public function get bytesTotal():Number
See also
bytesLoaded
, bytesTotal
and percentLoaded
properties by listening for the progress
and complete
events:
import fl.containers.ScrollPane; var url:String = "http://www.helpexamples.com/flash/images/image1.jpg"; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.setSize(320, 240); myScrollPane.move(10, 10); myScrollPane.addEventListener(ProgressEvent.PROGRESS, progressHandler); myScrollPane.addEventListener(Event.COMPLETE, completeHandler); myScrollPane.load(new URLRequest(url)); addChild(myScrollPane); function progressHandler(event:ProgressEvent):void { var bLoaded:int = event.bytesLoaded; var bTotal:int = event.bytesTotal; var pctLoaded:int = int(event.currentTarget.percentLoaded); trace("progress: " + bLoaded + " of " + bTotal + " bytes loaded (" + pctLoaded + "%)"); } function completeHandler(event:Event):void { trace("complete:"); }
content | property |
content:DisplayObject
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets a reference to the content loaded into the scroll pane.
The default value is null.
public function get content():DisplayObject
import fl.containers.ScrollPane; import fl.controls.NumericStepper; var ns:NumericStepper = new NumericStepper(); ns.minimum = 10; ns.maximum = 100; ns.stepSize = 10; ns.value = ns.maximum; ns.addEventListener(Event.CHANGE, updateScrollPaneContentAlpha); addChild(ns); var sp:ScrollPane = new ScrollPane(); sp.move(0,30); sp.setSize(180, 160); sp.source = "http://www.helpexamples.com/flash/images/image2.jpg"; addChild(sp); function updateScrollPaneContentAlpha(e:Event):void { sp.content.alpha = e.target.value / 100; }
import fl.containers.ScrollPane; import fl.controls.Button; import fl.events.ComponentEvent; var MAX_SCROLLPANE_WIDTH:uint = 400; var MAX_SCROLLPANE_HEIGHT:uint = 267; var url:String = "http://www.helpexamples.com/flash/images/image1.jpg"; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.scrollDrag = true; myScrollPane.cacheAsBitmap = true; myScrollPane.setSize(MAX_SCROLLPANE_WIDTH, MAX_SCROLLPANE_HEIGHT); myScrollPane.move(10, 10); myScrollPane.addEventListener(Event.COMPLETE, completeHandler); myScrollPane.load(new URLRequest(url)); addChild(myScrollPane); var zoomInButton:Button = new Button(); zoomInButton.autoRepeat = true; zoomInButton.enabled = false; zoomInButton.label = "Zoom in (+)"; zoomInButton.move(420, 10); zoomInButton.addEventListener(ComponentEvent.BUTTON_DOWN, zoomInHandler); addChild(zoomInButton); var zoomOutButton:Button = new Button(); zoomOutButton.autoRepeat = true; zoomOutButton.enabled = false; zoomOutButton.label = "Zoom out (-)"; zoomOutButton.move(420, 40); zoomOutButton.addEventListener(ComponentEvent.BUTTON_DOWN, zoomOutHandler); addChild(zoomOutButton); var cacheButton:Button = new Button(); cacheButton.enabled = false; cacheButton.emphasized = myScrollPane.cacheAsBitmap; cacheButton.label = "cacheAsBitmap"; cacheButton.toggle = true; cacheButton.selected = myScrollPane.cacheAsBitmap; cacheButton.move(420, 70); cacheButton.addEventListener(Event.CHANGE, changeHandler); addChild(cacheButton); function completeHandler(event:Event):void { zoomInButton.enabled = true; zoomOutButton.enabled = true; cacheButton.enabled = true; myScrollPane.removeEventListener(Event.COMPLETE, completeHandler); } function changeHandler(event:Event):void { myScrollPane.cacheAsBitmap = !myScrollPane.cacheAsBitmap; cacheButton.emphasized = myScrollPane.cacheAsBitmap; } function zoomInHandler(event:ComponentEvent):void { var zoomLvl:Number = myScrollPane.content.scaleX * 1.1; updateSP(zoomLvl); } function zoomOutHandler(event:ComponentEvent):void { var zoomLvl:Number = myScrollPane.content.scaleX / 1.1; updateSP(zoomLvl); } function updateSP(newScale:Number):void { var img:DisplayObject = myScrollPane.content as DisplayObject; img.scaleY = newScale; img.scaleX = newScale; myScrollPane.width = Math.min(img.width, MAX_SCROLLPANE_WIDTH); myScrollPane.height = Math.min(img.height, MAX_SCROLLPANE_HEIGHT); myScrollPane.update(); }
percentLoaded | property |
percentLoaded:Number
[read-only] Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets a number between 0 and 100 indicating what percentage of the content is loaded.
If you are loading assets from your library, and not externally loaded content,
the percentLoaded
property is set to 0.
The default value is 0.
public function get percentLoaded():Number
See also
bytesLoaded
, bytesTotal
and percentLoaded
properties by listening for the progress
and complete
events:
import fl.containers.ScrollPane; var url:String = "http://www.helpexamples.com/flash/images/image1.jpg"; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.setSize(320, 240); myScrollPane.move(10, 10); myScrollPane.addEventListener(ProgressEvent.PROGRESS, progressHandler); myScrollPane.addEventListener(Event.COMPLETE, completeHandler); myScrollPane.load(new URLRequest(url)); addChild(myScrollPane); function progressHandler(event:ProgressEvent):void { var bLoaded:int = event.bytesLoaded; var bTotal:int = event.bytesTotal; var pctLoaded:int = int(event.currentTarget.percentLoaded); trace("progress: " + bLoaded + " of " + bTotal + " bytes loaded (" + pctLoaded + "%)"); } function completeHandler(event:Event):void { trace("complete:"); }
scrollDrag | property |
scrollDrag:Boolean
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 scrolling occurs when a
user drags on content within the scroll pane. A value of true
indicates that scrolling occurs when a user drags on the content; a value
of false
indicates that it does not.
The default value is false.
public function get scrollDrag():Boolean
public function set scrollDrag(value:Boolean):void
See also
import fl.containers.ScrollPane; import fl.events.ScrollEvent; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.scrollDrag = true; myScrollPane.source = "http://www.helpexamples.com/flash/images/image2.jpg"; myScrollPane.addEventListener(ScrollEvent.SCROLL, scrollHandler); myScrollPane.move(10, 10); addChild(myScrollPane); function scrollHandler(event:ScrollEvent):void { var mySP:ScrollPane = event.currentTarget as ScrollPane; trace("scrolling"); trace("\t" + "direction:", event.direction); trace("\t" + "position:", event.position); trace("\t" + "horizontalScrollPosition:", mySP.horizontalScrollPosition, "of", mySP.maxHorizontalScrollPosition); trace("\t" + "verticalScrollPosition:", mySP.verticalScrollPosition, "of", mySP.maxVerticalScrollPosition); }
source | property |
source:Object
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Gets or sets an absolute or relative URL that identifies the location of the SWF or image file to load, the class name of a movie clip in the library, a reference to a display object, or a instance name of a movie clip on the same level as the component.
Valid image file formats include GIF, PNG, and JPEG. To load an
asset by using a URLRequest object, use the load()
method.
The default value is null.
public function get source():Object
public function set source(value:Object):void
See also
source
property:
import fl.containers.ScrollPane; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.source = "http://www.helpexamples.com/flash/images/image1.jpg"; myScrollPane.setSize(320, 240); myScrollPane.move(10, 10); addChild(myScrollPane);
source
property:
import fl.containers.ScrollPane; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.source = Box; myScrollPane.setSize(320, 240); myScrollPane.move(10, 10); addChild(myScrollPane);
ScrollPane | () | Constructor |
public function ScrollPane()
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Creates a new ScrollPane 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.
|
See also
import fl.controls.*; import fl.containers.*; import fl.controls.listClasses.*; import fl.controls.dataGridClasses.*; import fl.controls.progressBarClasses.*; import fl.core.UIComponent; import fl.data.DataProvider; var dp:DataProvider = new DataProvider(); dp.addItem( { label: "BaseScrollPane", data:BaseScrollPane } ); dp.addItem( { label: "Button", data:Button } ); dp.addItem( { label: "CellRenderer", data:CellRenderer } ); dp.addItem( { label: "CheckBox", data:CheckBox } ); dp.addItem( { label: "ColorPicker", data:ColorPicker } ); dp.addItem( { label: "ComboBox", data:ComboBox } ); dp.addItem( { label: "DataGrid", data:DataGrid } ); dp.addItem( { label: "HeaderRenderer", data:HeaderRenderer } ); dp.addItem( { label: "ImageCell", data:ImageCell } ); dp.addItem( { label: "IndeterminateBar",data:IndeterminateBar } ); dp.addItem( { label: "Label", data:Label } ); dp.addItem( { label: "List", data:List } ); dp.addItem( { label: "NumericStepper", data:NumericStepper } ); dp.addItem( { label: "ProgressBar", data:ProgressBar } ); dp.addItem( { label: "RadioButton", data:RadioButton } ); dp.addItem( { label: "ScrollPane", data:ScrollPane } ); dp.addItem( { label: "Slider", data:Slider } ); dp.addItem( { label: "TextArea", data:TextArea } ); dp.addItem( { label: "TextInput", data:TextInput } ); dp.addItem( { label: "TileList", data:TileList } ); dp.addItem( { label: "UILoader", data:UILoader } ); dp.addItem( { label: "UIComponent", data:UIComponent } ); var cb:ComboBox = new ComboBox(); cb.move(10,10); cb.setSize(300,25); cb.prompt = "Select a component to view its styles"; cb.rowCount = 12; cb.dataProvider = dp; cb.addEventListener(Event.CHANGE, showStyleDefinition); addChild(cb); var dg:DataGrid = new DataGrid(); dg.setSize(425,300); dg.move(10,50); dg.columns = [ new DataGridColumn("StyleName"), new DataGridColumn("DefaultValue") ]; addChild(dg); function showStyleDefinition(e:Event):void { var componentClass:Class = e.target.selectedItem.data as Class; var styles:Object = componentClass["getStyleDefinition"].call(this); trace(styles.toString()); var styleData:DataProvider = new DataProvider(); for(var i:* in styles) { trace(i + " : " + styles[i]); styleData.addItem( { StyleName:i, DefaultValue:styles[i] } ); } styleData.sortOn("StyleName"); dg.dataProvider = styleData; }
load | () | method |
public function load(request:URLRequest, context:LoaderContext = null):void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
The request parameter of this method accepts only a URLRequest object
whose source
property contains a string, a class, or a
URLRequest object.
By default, the LoaderContext object uses the current domain as the
application domain. To specify a different application domain value,
to check a policy file, or to change the security domain, initialize
a new LoaderContext object and pass it to this method.
Parameters
request:URLRequest — The URLRequest object to use to load an image into the scroll pane.
| |
context:LoaderContext (default = null ) — The LoaderContext object that sets the context of the load operation.
|
See also
import fl.containers.ScrollPane; var request:URLRequest = new URLRequest("http://www.helpexamples.com/flash/images/image1.jpg"); var sp:ScrollPane = new ScrollPane(); sp.setSize(180, 160); sp.load(request); addChild(sp);
refreshPane | () | method |
public function refreshPane():void
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Reloads the contents of the scroll pane.
This method does not redraw the scroll bar. To reset the
scroll bar, use the update()
method.
See also
refreshPane()
method:
import fl.containers.ScrollPane; import fl.controls.Button; import fl.controls.TextArea; var url:String = "http://www.helpexamples.com/flash/images/image2.jpg"; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.setSize(320, 240); myScrollPane.move(10, 10); myScrollPane.load(new URLRequest(url)); myScrollPane.addEventListener(ProgressEvent.PROGRESS, progressHandler); myScrollPane.addEventListener(Event.COMPLETE, completeHandler); addChild(myScrollPane); var refreshButton:Button = new Button(); refreshButton.emphasized = true; refreshButton.label = "refreshPane()"; refreshButton.move(myScrollPane.x + myScrollPane.width + 10, myScrollPane.y); refreshButton.addEventListener(MouseEvent.CLICK, clickHandler); addChild(refreshButton); var myTextArea:TextArea = new TextArea(); myTextArea.editable = false; myTextArea.setSize(320, 120); myTextArea.move(myScrollPane.x, myScrollPane.y + myScrollPane.height + 10); addChild(myTextArea); function progressHandler(event:ProgressEvent):void { var bLoaded:int = event.bytesLoaded; var bTotal:int = event.bytesTotal; var pctLoaded:int = int(event.currentTarget.percentLoaded); addText("progress (" + bLoaded + " of " + bTotal + " bytes loaded -- " + pctLoaded + "%)"); } function completeHandler(event:Event):void { addText("complete"); addText("----------"); } function clickHandler(event:MouseEvent):void { myScrollPane.refreshPane(); } function addText(str:String):void { myTextArea.appendText(str + "\n"); myTextArea.verticalScrollPosition = myTextArea.maxVerticalScrollPosition; }
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 |
Refreshes the scroll bar properties based on the width and height of the content. This is useful if the content of the ScrollPane changes during run time.
See also
import fl.containers.ScrollPane; import fl.controls.Button; var baseURL:String = "http://www.helpexamples.com/flash/images/"; var img1Button:Button = new Button(); img1Button.label = "Image 1"; img1Button.move(10, 10); img1Button.addEventListener(MouseEvent.CLICK, clickHandler); addChild(img1Button); var img2Button:Button = new Button(); img2Button.label = "Image 2"; img2Button.move(10, 40); img2Button.addEventListener(MouseEvent.CLICK, clickHandler); addChild(img2Button); var img3Button:Button = new Button(); img3Button.label = "Image 3"; img3Button.move(10, 70); img3Button.addEventListener(MouseEvent.CLICK, clickHandler); addChild(img3Button); var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.setSize(320, 240); myScrollPane.move(120, 10); myScrollPane.addEventListener(Event.COMPLETE, completeHandler); addChild(myScrollPane); function clickHandler(event:MouseEvent):void { switch (event.currentTarget) { case img1Button: myScrollPane.source = baseURL + "image1.jpg"; break; case img2Button: myScrollPane.source = baseURL + "image2.jpg"; break; case img3Button: myScrollPane.source = baseURL + "image3.jpg"; break; } } function completeHandler(event:Event):void { myScrollPane.update(); }
complete | Event |
flash.events.Event
flash.events.Event.COMPLETE
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when content has finished loading.
TheEvent.COMPLETE
constant defines the value of the type
property of a complete
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The network object that has completed loading. |
progress
and complete
events.
Once the image load is complete, the ScrollPane is resized (using the setSize()
method), centered on the stage, and added to the display list.
import fl.containers.ScrollPane; import fl.controls.Label; var url:String = "http://www.helpexamples.com/flash/images/image1.jpg"; var conversion:Number = 1024; var myLabel:Label = new Label(); myLabel.autoSize = TextFieldAutoSize.LEFT; myLabel.text = ""; myLabel.move(10, 10); addChild(myLabel); var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.addEventListener(ProgressEvent.PROGRESS, progressHandler); myScrollPane.addEventListener(Event.COMPLETE, completeHandler); myScrollPane.load(new URLRequest(url)); function progressHandler(event:ProgressEvent):void { var bLoaded:int = int(event.bytesLoaded / conversion); var bTotal:int = int(event.bytesTotal / conversion); var pctLoaded:int = event.target.percentLoaded as int; myLabel.text = bLoaded + " of " + bTotal + " (" + pctLoaded + "%)"; } function completeHandler(event:Event):void { var img:DisplayObject = myScrollPane.content; myScrollPane.removeEventListener(ProgressEvent.PROGRESS, progressHandler); myScrollPane.removeEventListener(Event.COMPLETE, completeHandler); removeChild(myLabel); myScrollPane.setSize(img.width, img.height); var newX:uint = (stage.stageWidth - myScrollPane.width) / 2; var newY:uint = (stage.stageHeight - myScrollPane.height) / 2; myScrollPane.move(newX, newY); addChild(myScrollPane); }
See also
init | Event |
flash.events.Event
flash.events.Event.INIT
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the properties and methods of a loaded SWF file are accessible. The following conditions must exist for this event to be dispatched:
Event.INIT
constant defines the value of the type
property of an init
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The LoaderInfo object associated with the SWF file being loaded. |
ioError | Event |
flash.events.IOErrorEvent
flash.events.IOErrorEvent.IO_ERROR
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after an input or output error occurs.
Defines the value of thetype
property of an ioError
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
errorID | A reference number associated with the specific error (AIR only). |
target | The network object experiencing the input/output error. |
text | Text to be displayed as an error message. |
ioError
event to be dispatched:
import fl.containers.UILoader; var url:String = "http://www.helpexamples.com/flash/images/image404.jpg" var myUILoader:UILoader = new UILoader(); myUILoader.load(new URLRequest(url)); myUILoader.move(10, 10); myUILoader.addEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); addChild(myUILoader); function ioErrorHandler(event:IOErrorEvent):void { trace("<<", event.text, ">>"); myUILoader.removeEventListener(IOErrorEvent.IO_ERROR, ioErrorHandler); removeChild(myUILoader); }
open | Event |
flash.events.Event
flash.events.Event.OPEN
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after a network operation starts.
TheEvent.OPEN
constant defines the value of the type
property of an open
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The network object that has opened a connection. |
progress | Event |
flash.events.ProgressEvent
flash.events.ProgressEvent.PROGRESS
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched while content is loading.
Defines the value of thetype
property of a progress
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
bytesLoaded | The number of items or bytes loaded at the time the listener processes the event. |
bytesTotal | The total number of items or bytes that ultimately will be loaded if the loading process succeeds. |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The object reporting progress. |
bytesLoaded
, bytesTotal
and percentLoaded
properties by listening for the progress
and complete
events:
import fl.containers.ScrollPane; var url:String = "http://www.helpexamples.com/flash/images/image1.jpg"; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.setSize(320, 240); myScrollPane.move(10, 10); myScrollPane.addEventListener(ProgressEvent.PROGRESS, progressHandler); myScrollPane.addEventListener(Event.COMPLETE, completeHandler); myScrollPane.load(new URLRequest(url)); addChild(myScrollPane); function progressHandler(event:ProgressEvent):void { var bLoaded:int = event.bytesLoaded; var bTotal:int = event.bytesTotal; var pctLoaded:int = int(event.currentTarget.percentLoaded); trace("progress: " + bLoaded + " of " + bTotal + " bytes loaded (" + pctLoaded + "%)"); } function completeHandler(event:Event):void { trace("complete:"); }
See also
scroll | Event |
fl.events.ScrollEvent
fl.events.ScrollEvent.SCROLL
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched when the user scrolls content by using the scroll bars on the component or the wheel on a mouse device.
Defines the value of the
type
property of a scroll
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default
behavior to cancel. |
currentTarget | The object that is actively processing the event object with an event listener. |
delta | 1 ; a value that indicates
how much scrolling was done.
|
direction | vertical ; the direction of the
ScrollBar. |
position | 0 ; the position of the
Scrollbar thumb after it was moved. |
target | The object that dispatched the event. The target is
not always the object listening for the event. Use the currentTarget
property to access the object that is listening for the event. |
scroll
event
and uses the direction
property of the ScrollEvent class to
determine if the content was scrolled horizontally or vertically:
import fl.containers.ScrollPane; import fl.events.ScrollEvent; import fl.controls.ScrollBarDirection; var myScrollPane:ScrollPane = new ScrollPane(); myScrollPane.scrollDrag = true; myScrollPane.source = "http://www.helpexamples.com/flash/images/image1.jpg"; myScrollPane.addEventListener(ScrollEvent.SCROLL, scrollHandler); addChild(myScrollPane); function scrollHandler(event:ScrollEvent):void { switch (event.direction) { case ScrollBarDirection.HORIZONTAL: trace("horizontal scroll", event.position, "of", event.currentTarget.maxHorizontalScrollPosition); break; case ScrollBarDirection.VERTICAL: trace("vertical scroll", event.position, "of", event.currentTarget.maxVerticalScrollPosition); break; } }
securityError | Event |
flash.events.SecurityErrorEvent
flash.events.SecurityErrorEvent.SECURITY_ERROR
Language Version: | ActionScript 3.0 |
Product Version: | Flash CS3 |
Runtime Versions: | Flash Player 9.0.28.0, AIR 1.0 |
Dispatched after a security error occurs while content is loading.
TheSecurityErrorEvent.SECURITY_ERROR
constant defines the value of the type
property of a securityError
event object.
This event has the following properties:
Property | Value |
---|---|
bubbles | false |
cancelable | false ; there is no default behavior to cancel. |
currentTarget | The object that is actively processing the Event object with an event listener. |
target | The network object reporting the security error. |
text | Text to be displayed as an error message. |
test.jpg
in the same directory as your FLA (the larger the better)Note:The image must be larger than the ScrollPane (425x380) to interact with the image. The image must also be smaller than 2880 width and height in order for a image to appear in the preview window due to tha maximum dimensions of bitmap data.
package { import flash.display.Sprite; import flash.display.Shape; import flash.display.MovieClip; import flash.events.*; import flash.geom.Rectangle; import flash.display.Bitmap; import flash.display.BitmapData; import fl.containers.ScrollPane; import fl.events.ScrollEvent; public class ScrollPaneExample extends Sprite { private var sampleImagePath:String = "test.jpg"; private var sp:ScrollPane; private var previewPositioner:Sprite; private var windowSize:Number = 100; private var box:Sprite; public function ScrollPaneExample() { stage.frameRate = 31; createScrollPane(); } private function createScrollPane():void { sp = new ScrollPane(); sp.move(10,10); sp.setSize(425,380); sp.source = sampleImagePath; sp.addEventListener(Event.COMPLETE,createPreviewWindow); sp.addEventListener(ScrollEvent.SCROLL,repositionPreview); sp.scrollDrag = true; addChild(sp); } private function createPreviewWindow(e:Event):void { var previewWindow:Sprite = new Sprite(); previewWindow.x = 445; previewWindow.y = 10; previewWindow.graphics.lineStyle(1,0,1); previewWindow.graphics.drawRect(0,0,windowSize,windowSize); addChild(previewWindow); var bitmapData:BitmapData try { bitmapData = new BitmapData(sp.content.width,sp.content.height); bitmapData.draw(sp.content); var bitmap:Bitmap = new Bitmap(bitmapData); bitmap.width = windowSize; bitmap.height = windowSize; bitmap.alpha = 0.25 previewWindow.addChild(bitmap); } catch (e:Error) { trace(e.toString()); } previewPositioner = new Sprite(); previewPositioner.graphics.beginFill(0xFFFFFF,0.5); previewPositioner.graphics.lineStyle(1,0,0.5); previewPositioner.graphics.drawRect(0,0,getHorizontalAspect() * windowSize, getVerticalAspect() * windowSize); previewPositioner.addEventListener(MouseEvent.MOUSE_DOWN, dragPreviewPositioner); previewPositioner.addEventListener(MouseEvent.MOUSE_UP, dropPreviewPositioner); previewWindow.addChild(previewPositioner); } private function dragPreviewPositioner(e:MouseEvent):void { var bounds:Rectangle = new Rectangle(0,0,windowSize - Math.floor(previewPositioner.width) + 1,windowSize - Math.floor(previewPositioner.height) + 1); previewPositioner.startDrag(false,bounds); previewPositioner.addEventListener(MouseEvent.MOUSE_MOVE, repositionScrollPane); } private function dropPreviewPositioner(e:MouseEvent):void { previewPositioner.stopDrag(); previewPositioner.removeEventListener(MouseEvent.MOUSE_MOVE, repositionScrollPane); } private function repositionScrollPane(e:MouseEvent):void { sp.horizontalScrollPosition = (previewPositioner.x / windowSize) * sp.content.width; sp.verticalScrollPosition = (previewPositioner.y / windowSize) * sp.content.height; } private function repositionPreview(e:ScrollEvent):void { previewPositioner.x = (sp.horizontalScrollPosition * windowSize) / sp.content.width; previewPositioner.y = (sp.verticalScrollPosition * windowSize) / sp.content.height; } private function getHorizontalAspect():Number { return sp.width / sp.content.width; } private function getVerticalAspect():Number { return sp.height / sp.content.height; } } }