Main Page | Packages | Class Tree | Index | Help

com.bjc.controls

class ScrollPane

MovieClip
  |
  +--com.bjc.core.BJCComponent
        |
        +--com.bjc.controls.ScrollPane


class ScrollPane
extends BJCComponent

A scroll pane that can hold a large movie clip or image. If the image is larger than the scroll pane, the user can scroll or drag it around to view other parts of it. This component also allows the user to zoom in and out of the content.

Events:

load - Fired when the content being loaded by the scrollpane has completely loaded.
progress - Fired once each frame while content is being loaded into the scrollpane.
scroll - Fired once each frame while content is being scrolled or dragged.
focus - Fired whenever the component receives focus.
killFocus - Fired whenever the component loses focus.
tabFocus - Fired whenever the component receives focus by pressing the TAB key.


Author:
Flashloaded - www.flashloaded.com


Field Summary

public
addEventListener: Function
See the EventDispatcher Class in Flash Help

public
focusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

public
loadHandler: Function
Can be used to assign a direct event handler to the component instance.

public
progressHandler: Function
Can be used to assign a direct event handler to the component instance.

public
removeEventListener: Function
See the EventDispatcher Class in Flash Help

public
scrollHandler: Function
Can be used to assign a direct event handler to the component instance.

public
tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Fields inherited from class com.bjc.core.BJCComponent

version

Property Summary

public
content: MovieClip (read-only)
Returns a reference to the content loaded into the scrollpane. Note that if you alter the content after it has been set, you should invalidate the scrollpane so that the scrollbars correctly reflect the size and position of the new content.

public
contentPath: String (write)
Sets the linkage name of a symbol in the library to attach inside the scrollpane, or the url of an external swf or jpg image to load in.

public
contentPath: String (read)
Gets the linkage name of a symbol in the library to attach inside the scrollpane, or the url of an external swf or jpg image to load in.

public
dragContent: Boolean (write)
Sets the drag mode of the component. If true, content can be moved around by clicking and dragging within the scrollpane. If false, scrollbars must be used to move the content.

public
dragContent: Boolean (read)
Gets the drag mode of the component.

public
hScrollPosition: Number (write)
Sets the horizontal position of the content in the scrollpane.

public
hScrollPosition: Number (read)
Gets the horizontal position of the content in the scrollpane.

public
maxHScrollPosition: Number (read-only)
Gets the maximum horizontal position of the content in the scrollpane.

public
maxVScrollPosition: Number (read-only)
Gets the maximum vertical position of the content in the scrollpane.

public
progress: Number (read-only)
The percentage of content loaded into the scrollpane. If you are attaching a symbol, this will be either 0 or 100 (before and after attaching). If you are loading external content, this will go from 0 to 100 as the content loads in.

public
scrollBarPolicy: String (write)
Sets the visibility of the scrollbars in the scrollpane. If set to 'yes', the scrollbars are always visible. If set to 'no', the scrollbars are not visible. If set to 'auto', the scrollbars are visible when needed.

public
scrollBarPolicy: String (read)
Gets the scrollBarPolicy mode of the scrollpane.

public
scrollBarWidth: Number (write)
Sets the width of the scrollbars (if visible) in the scrollpane. Note that width here refers to both the width of the veritical scrollbar AND the height of hte horizontal scrollbar.

public
scrollBarWidth: Number (read)
Gets the width of the scrollbars in the scrollpane.

public
vScrollPosition: Number (write)
Sets the vertical position of the content in the scrollpane.

public
vScrollPosition: Number (read)
Gets the vertical position of the content in the scrollpane.

public
zoom: Number (write)
Sets the _xscale and _yscale of the content. Special care has been taken to ensure that scaling and scrolling the content will not result in the content going "out of bounds" and becoming invisible.

public
zoom: Number (read)
Gets the _xscale and _yscale of the content.

Properties inherited from class com.bjc.core.BJCComponent

disabledAlpha, enabled, focusTime, height, keyEnabled, style, width

Constructor

public
ScrollPane ( Void)


Method Summary

public
alignLeft ( Void ): Void
Sets the content to line up on the left edge of the scroll pane

public
alignTop ( Void ): Void
Sets the content to line up on the top edge of the scroll pane

public static
create ( target: MovieClip, id: String, depth: Number, initObj: Object ): ScrollPane
Static method used to create an instance of a ScrollPane on stage at run time.

public
refresh ( Void ): Void
Refreshes the scrollbars of the scrollpane. May be used when the content size have changed.

public
zoomFull ( Void ): Void
Sets the zoom so that all of the content will be visible within the area of the scrollpane, and no scrollbars will be necessary.

public
zoomHeight ( Void ): Void
Sets the zoom so that the content's height will be that of the scrollpane's height, and no vertical scrollbar will be necessary.

public
zoomWidth ( Void ): Void
Sets the zoom so that the content's width will be that of the scrollpane's width, and no horizontal scrollbar will be necessary.

Methods inherited from class com.bjc.core.BJCComponent

draw, invalidate, move, remove, setSize



Field Documentation

addEventListener

public var addEventListener: Function
See the EventDispatcher Class in Flash Help

focusHandler

public var focusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myScrollPane.focusHandler = function(){
trace("Set focus.");
}

killFocusHandler

public var killFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myScrollPane.killFocusHandler = function(){
trace("Kill focus.");
}

loadHandler

public var loadHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myScrollPane.loadHandler = function(){
trace("I am done loading.");
}

progressHandler

public var progressHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myScrollPane.progressHandler = function(){
trace("I am loading.");
}

removeEventListener

public var removeEventListener: Function
See the EventDispatcher Class in Flash Help

scrollHandler

public var scrollHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myScrollPane.scrollHandler = function(obj){
trace("Scroll position: " + obj.x + ", " + obj.y);
}

tabFocusHandler

public var tabFocusHandler: Function
Can be used to assign a direct event handler to the component instance.

Usage:
myScrollPane.tabFocusHandler = function(){
trace("Tab focus.");
}


Property Documentation

content

public content: MovieClip (read-only)
Returns a reference to the content loaded into the scrollpane. Note that if you alter the content after it has been set, you should invalidate the scrollpane so that the scrollbars correctly reflect the size and position of the new content.

Example:
myScrollPane.content.attachMovie("someAdditionalContent", "stuff", 0);
myScrollPane.invalidate();

contentPath

public contentPath: String (write)
Sets the linkage name of a symbol in the library to attach inside the scrollpane, or the url of an external swf or jpg image to load in.

Example:
myScrollPane.contentPath = "exportedMovieClip";
myOtherScrollPane.contentPath = "http://www.somedomain.com/somepicture.jpg";

contentPath

public contentPath: String (read)
Gets the linkage name of a symbol in the library to attach inside the scrollpane, or the url of an external swf or jpg image to load in.

Example:
myVar = myScrollPane.contentPath;

dragContent

public dragContent: Boolean (write)
Sets the drag mode of the component. If true, content can be moved around by clicking and dragging within the scrollpane. If false, scrollbars must be used to move the content.

Example:
myScrollPane.dragContent = false;

dragContent

public dragContent: Boolean (read)
Gets the drag mode of the component.

Example:
myVar = myScrollPane.dragContent;

hScrollPosition

public hScrollPosition: Number (write)
Sets the horizontal position of the content in the scrollpane.

Example:
myScrollpane.hScrollPosition = 10;

hScrollPosition

public hScrollPosition: Number (read)
Gets the horizontal position of the content in the scrollpane.

Example:
myVar = myScrollpane.hScrollPosition;

maxHScrollPosition

public maxHScrollPosition: Number (read-only)
Gets the maximum horizontal position of the content in the scrollpane.

Example:
myVar = myScrollpane.maxHScrollPosition;

maxVScrollPosition

public maxVScrollPosition: Number (read-only)
Gets the maximum vertical position of the content in the scrollpane.

Example:
myVar = myScrollpane.maxVScrollPosition;

progress

public progress: Number (read-only)
The percentage of content loaded into the scrollpane. If you are attaching a symbol, this will be either 0 or 100 (before and after attaching). If you are loading external content, this will go from 0 to 100 as the content loads in.

Example:
trace(myScrollpane.progress);

scrollBarPolicy

public scrollBarPolicy: String (write)
Sets the visibility of the scrollbars in the scrollpane. If set to 'yes', the scrollbars are always visible. If set to 'no', the scrollbars are not visible. If set to 'auto', the scrollbars are visible when needed.

Example:
myScrollpane.scrollBarPolicy = "no";

scrollBarPolicy

public scrollBarPolicy: String (read)
Gets the scrollBarPolicy mode of the scrollpane.

Example:
myVar = myScrollpane.scrollBarPolicy;

scrollBarWidth

public scrollBarWidth: Number (write)
Sets the width of the scrollbars (if visible) in the scrollpane. Note that width here refers to both the width of the veritical scrollbar AND the height of hte horizontal scrollbar.

Example:
myScrollpane.scrollBarWidth = 20;

scrollBarWidth

public scrollBarWidth: Number (read)
Gets the width of the scrollbars in the scrollpane.

Example:
myVar = myScrollpane.scrollBarWidth;

vScrollPosition

public vScrollPosition: Number (write)
Sets the vertical position of the content in the scrollpane.

Example:
myScrollpane.vScrollPosition = 10;

vScrollPosition

public vScrollPosition: Number (read)
Gets the vertical position of the content in the scrollpane.

Example:
myVar = myScrollpane.vScrollPosition;

zoom

public zoom: Number (write)
Sets the _xscale and _yscale of the content. Special care has been taken to ensure that scaling and scrolling the content will not result in the content going "out of bounds" and becoming invisible.

Example:
myScrollPane.zoom = 150;

zoom

public zoom: Number (read)
Gets the _xscale and _yscale of the content.

Example:
myVar = myScrollPane.zoom;


Constructor Documentation

ScrollPane

public function ScrollPane(Void)

Method Documentation

alignLeft

public function alignLeft(Void): Void
Sets the content to line up on the left edge of the scroll pane

Example:
myScrollPane.alignLeft();

alignTop

public function alignTop(Void): Void
Sets the content to line up on the top edge of the scroll pane

Example:
myScrollPane.alignLeft();

create

public static function create(target: MovieClip,
 id: String,
 depth: Number,
 initObj: Object): ScrollPane
Static method used to create an instance of a ScrollPane on stage at run time.

Parameters:
target
the movie clip to which the scroll pane will be attached.
id
the instance name given to the new scroll pane attached.
depth
the depth at which to attach the new scroll pane.
initObj
(optional) an object containing any properties you want to assign to the component when it is created
Returns:
a reference to the new scroll pane attached.

Example:
import com.bjc.controls.ScrollPane;
var newScrollPane:ScrollPane = ScrollPane.create(_root, "myScrollPane", 0);

refresh

public function refresh(Void): Void
Refreshes the scrollbars of the scrollpane. May be used when the content size have changed.

Example:
myScrollPane.refresh();

zoomFull

public function zoomFull(Void): Void
Sets the zoom so that all of the content will be visible within the area of the scrollpane, and no scrollbars will be necessary.

Example:
myScrollPane.zoomFull();

zoomHeight

public function zoomHeight(Void): Void
Sets the zoom so that the content's height will be that of the scrollpane's height, and no vertical scrollbar will be necessary.

Example:
myScrollPane.zoomHeight();

zoomWidth

public function zoomWidth(Void): Void
Sets the zoom so that the content's width will be that of the scrollpane's width, and no horizontal scrollbar will be necessary.

Example:
myScrollPane.zoomWidth();


The documentation was generated from the following file:


Copyright Flashloaded - www.flashloaded.com