xm.components.VScrollbarComponent
- Class:
- xm.components.VScrollbarComponent
- Inheritance:
- MovieClip > xm.corpus.resizableComponent > xm.components.VScrollbarComponent
- Edition:
- Flash 8
- Language Version:
- ActionScript 2.0
- Player Version:
- Flash Player 7
- Preview:
- Scrollbar Component Preview
About
Scrollbar Component scrolls text fields, symbols (using ScrollArea component), and movie clip instances already present on stage (using MaskArea component). It comes in nine flavors and supports easing, mouse-wheel, and keyboard scrolling.
Quick Links
Methods
scrollTo(p_pos:Number) : Void
Scrolls the target to a specified position, in pixels or lines (in case of scrolling a text field).
Example
// scroll to top myScrollbar.scrollTo(0); // scroll to bottom (scrolling constraints will be automatically enforced) myScrollbar.scrollTo(Infinity);
Methods inherited from the resizableClip class
setSize(p_width:Number, p_height:Number) : Void
Resizes the component to the requested size. (Dimensions are always rounded.)
addEventListener(p_eventName:String, p_handler) : Void
Registers a listener object or function (p_handler) with a component instance that is broadcasting an event. When the event occurs, the listener object or function is notified. If p_handler is a function, it will be invoked from within the dispatching object's scope.
Example 1
myResizableComponent.addEventListener("resize", this);
function resize(e:Object):Void {
trace("event: "+e.type);
trace("new w: "+myResizableComponent.widht);
trace("new h: "+myResizableComponent.height);
// or: trace("new w: "+this.widht);
// or: trace("new h: "+this.height);
}
Example 2
myResizableComponent.addEventListener("resize", refreshLayout);
function refreshLayout(e:Object):Void {
// refresh layour here
}
addEventListenerL(p_eventName:String, p_obj:Object, p_handler) : Void
Registers a listener function (p_handler) with a component instance that is broadcasting an event. When the event occurs, the listener function is invoked using the p_obj scope.
Example
myResizableComponent.addEventListenerL("resize", this, "refreshLayout");
myResizableComponent.addEventListenerL("resize", myResizableComponent, function() { trace("Just resized: "+this); });
function refreshLayout(e:Object):Void {
// refresh layour here
}
removeEventListener(p_eventName:String, p_handler) : Void
Unregisters a listener.
Example 1
myResizableComponent.removeEventListener("resize", this);
Example 2
myResizableComponent.removeEventListener("resize", refreshLayout);
removeEventListenerL(p_eventName:String, p_obj:Object, p_handler) : Void
Unregisters a listener.
Example
myResizableComponent.removeEventListener("resize", this, "refreshLayout");
removeAllEventListeners(p_eventName:String) : Void
Unregisters all listeners registered with a p_eventName event.
Example
myResizableComponent.removeAllEventListeners("resize");
dispatchEvent(p_eventObj:Object) : Void
Dispatches an event to any listener registered with an instance of the class. This method is usually called from within a component's class file. p_eventObj is passed to all listeners, and must contain a type property indicating the name of the event.
Example
// trigger a custom event
myResizableComponent.dispatchEvent({ type: "justCompletedSomeLoading"});
Properties
enabled : Boolean
Indicates whether the component is enabled or not. The enabled state is represented with the second frame of the component's symbol (skin), and the disabled state (as well as the state when the content is not of the sufficent height/width to scroll) with the third frame.
target : Object
Specifies the text field, the ScrollArea Component, or the MaskArea Component that the scrollbar should scroll. This property should be specified through the Parameters panel only.
autoRepeat : Boolean
autoRepeat is an alias for the display.autoRepeat property. If set to true, causes the FLV file to play continuously, i.e. to start over each time upon reaching its end. The default value is false.
Example
myToobPlayer.autoRepeat = true;
volume : Number
volume is an alias for the display.volume property. It indicates the volume control setting. The default value is 50.
Example
// mute myToobPlayer.volume = 0;
showFullScreenButton : Boolean
Toggles the display of the full-screen button.
Example
myToobPlayer.showFullScreenButton = true;
mouseWheel : String
Determines how the component behaves when the user rolls the mouse wheel over the component area. Possible values are "none", "seek", and "volume". By default, this value is "seek".
Example
// disable mouse wheel myToobPlayer.mouseWheel = "none";
mouseWheelSeekStep : Number
Indicates the playhead increment or decrement (in seconds) for each notch the user rolls the mouse wheel. Larger value produces faster seeking. The default value is 5 seconds.
Example
myToobPlayer.mouseWheel = "seek"; // faster seeking using mouse wheel myToobPlayer.mouseWheelSeekStep = 10;
mouseWheelVolumeStep : Number
Indicates the volume increment or decrement (in percent) for each notch the user rolls the mouse wheel. Larger value produces faster volume change. The default value is 5 percent.
Example
myToobPlayer.mouseWheel = "volume"; // faster volume control using mouse wheel myToobPlayer.mouseWheelVolumeStep = 10;
autoLoadYouTubePreviewImage : Boolean
Defines whether or not the YouTube preview image will be loaded automatically upon setting the url property.
Example
myToobPlayer.autoPlay = false; myToobPlayer.autoLoadYouTubePreviewImage = true; myToobPlayer.url = "http://www.youtube.com/watch?v=T8oRFcA0mFM";
isAcquiringYouTubeUrl : Boolean [read-only]
After setting the url property, there is a short period of time indicated by the isAcquiringYouTubeUrl property, during which the direct link to the YouTube video is acquired.
Example
myToobPlayer.display.addEventListener("acquiringYouTubeUrl", this);
myToobPlayer.display.addEventListener("acquiredYouTubeUrl", this);
myToobPlayer.url = "http://www.youtube.com/watch?v=T8oRFcA0mFM";
function acquiringYouTubeUrl() {
trace(myToobPlayer.isAcquiringYouTubeUrl); // true
}
function acquiredYouTubeUrl() {
trace(myToobPlayer.isAcquiringYouTubeUrl); // false
trace(myToobPlayer.display.url); // the acquired address of the YouTube video
}
isFullScreen : Boolean [read-only]
Indicates whether the full-screen mode is active.
display : xm.components.FLVDisplayComponent
Reference to the FLVDisplay component. This component handles the FLV video.
Example
// rewind the video myToobPlayer.display.time = 0; myToobPlayer.display.pause(true);
ctrl : xm.components.FLVControllerComponent
Reference to the FLVController component. This component provides a user interface to control the video playback, set the video volume, etc.
image : xm.components.ImageContainerComponent
Reference to the ImageContainer component. This component is used to implement automatic loading of the YouTube preview images, and may also be used to display custom preview images.
Example
myToobPlayer.display.clear(); myToobPlayer.image.clear(); myToobPlayer.autoPlay = false; myToobPlayer.image.url = "myPreviewImage.jpg"; myToobPlayer.url = "myVideo.flv";
Properties inherited from the resizableClip class
width : Number
The width of the component, in pixels. (This value is always rounded.)
Example
myToobPlayer.width = 400;
height : Number
The height of the component, in pixels. (This value is always rounded.)
Example
trace("h: "+myToobPlayer.height);
minWidth : Number
The minimal width of the component, in pixels. By default, equals to 0.
minHeight : Number
The minimal height of the component, in pixels. By default, equals to 0.
maxWidth : Number
The maximal width of the component, in pixels. By default, equals to Infinity.
maxHeight : Number
The maximal height of the component, in pixels. By default, equals to Infinity.
Aligner : xm.corpus.aligner
Reference to the aligner object that manages the aligning within the component.
Events
enterFullScreen
Broadcast before entering the full-screen mode.
Example
myToobPlayer.addEventListener("enterFullScreen", this);
function enterFullScreen() {
trace("entering full-screen");
}
exitFullScreen
Broadcast after exiting the full-screen mode.
Example
myToobPlayer.addEventListener("exitFullScreen", this);
function enterFullScreen() {
trace("back from full-screen");
}
Events inherited from the resizableClip class
resize
Broadcast when the component has been resized.
Example
myToobPlayer.addEventListener("resize", this);
myToobPlayer._x = 0;
myToobPlayer._y = 0;
myToobPlayer.setSize(Stage.width, Stage.height);
function resize() {
trace("w: "+myToobPlayer.width+" h: "+myToobPlayer.height);
}
Possible output:
w: 1280 h: 1024
Class Summary
Methods
Methods inherited from the resizableClip class
- setSize(p_width:Number, p_height:Number) : Void
- addEventListener(p_eventName:String, p_handler) : Void
- addEventListenerL(p_eventName:String, p_obj:Object, p_handler) : Void
- removeEventListener(p_eventName:String, p_handler) : Void
- removeEventListenerL(p_eventName:String, p_obj:Object, p_handler) : Void
- removeAllEventListeners(p_eventName:String) : Void
- dispatchEvent(p_eventObj:Object) : Void
Properties
- enabled : Boolean
- target : Object
- scrollbarButtonStep : Number
- handleEasing : Boolean
- handleEasingDuration : Number
- handleEasingFunction : Function
Properties inherited from the resizableClip class
- width : Number
- height : Number
- minWidth : Number
- minHeight : Number
- maxWidth : Number
- maxHeight : Number
- Aligner : xm.corpus.aligner
Events
Events inherited from the resizableClip class
License and Links
The MIT License
Copyright (c) 2008 Elvis Mehmedović
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.