Scrollbar (ONLY commercially available)

Package:
Class:
Inheritance:
biz.flashscript.components.textarea.scrollBar
public class Scrollbar
AbstractClass extends Sprite
The Scrollbar class is used for the Scrollbar component. Different scrollbars can be attached, which adjust their height to the scroll distance or stay as they are. To create an instance of the Scrollbar use the constructor new Scrollbar().
Public Properties
Property Defined By
scrollDirection : String
Specifies the direction, vertical or horizontal for the scroll.
Scrollbar
clipHeight : int
Specifies the height of the mask.
Scrollbar
clipWidth : int
Specifies the width of the mask.
Scrollbar
barWidth : int
Specifies the width of the Scrollbar.
Scrollbar
displayObjectClip : DisplayObject
Specifies a DisplayObject.
Scrollbar
classicTextClip : TextField
Specifies a classic TextField.
Scrollbar
tlfClip : TLFTextField
Specifies a TLFTextField.
Scrollbar
scrollType : String
Specifies the bar type.
Scrollbar
Public Methods
Method Defined By
Scrollbar()
Creates a new instance of the Scrollbar component.
Scrollbar
activateScroll():void
Activates the scrollbar (optional).
Scrollbar
makeAdjustment(txtHeit:int):void
Allows making automatic adjustments in an editable TextField.
Scrollbar
Events
Event Defined By

scrollerActivated

This event is dispatched when the scrollbar is ready to scroll.

ArrayConvert
All inherited events for the Sprite class.
Property Detail
scrollDirection property
scrollDirection:String [read-write]

This specifies the scroll direction, "vertical" or "horizontal".

The default value is "vertical". .

.

Implementation

public function get scrollDirection():String
public function set scrollDirection(value:String):void

clipHeight property
clipHeight:int [read-write]

Specifies the height of the mask.

The default value is 0.

Implementation

public function get clipHeight():int
public function set clipHeight(value:int):void

clipWidth property
clipWidth:int [read-write]

Specifies the width of the mask.

The default value is 0.

Implementation

public function get clipWidth():int
public function set clipWidth(value:int):void

barWidth property
barWidth:int [read-write]

Specifies the width of the Scrollbar.

The default value is 10.

Implementation

public function get barWidth():int
public function set barWidth(value:int):void

displayObjectClip property
displayObjectClip:DisplayObject [read-write]

Specifies a DisplayObject.

The default value is false.

Implementation

public function get displayObjectClip():DisplayObject
public function set displayObjectClip(value:DisplayObject):void

classicTextClip property
classicTextClip:TextField [read-write]

Specifies a classic TextField.

There is no default.

Implementation

public function get classicTextClip():TextField
public function set classicTextClip(value:TextField):void

tlfCliptlfClip property
tlfClip:TLFTextField [read-write]

Specifies a TLFTextField.

There is no default.

Implementation

public function get tlfClip():TLFTextField
public function set tlfClip(value:TLFTextField):void

scrollType property
scrollType:String [read-write]

Specifies the scroll type, "scrollbar", "slider" or "square".

The default value is "scrollbar".

Implementation

public function get scrollType():String
public function set scrollType(value:String):void
Constructor Detail
Scrollbar ()  Constructor
public function Scrollbar()
Intializes a new Scrollbar instance.
Method Detail

activateScroll ()  method
public function activateScroll():void

This method will activate the scrollbar (optional).

makeAdjustment ()  method
public function makeAdjustment(txtHeit:int):void

This method will make adjustments when a text field is editable for editing.

Parameters

  • txtHeit:int ____ Specifies the text height in a text field.
Event Detail

scrollerActivated event

Event Object Type: biz.flashscript.components.textarea.scrollBar.Scrollbar
Event.type property = biz.flashscript.components.textarea.scrollBar.Scrollbar.SCROLLER_ACTIVATED

Dispatched when the file was loaded and the variables been extracted.

Examples
Create a new fla file and name it ScrollbarExample.fla. Place the fla in the same folder as the biz folder. Create two instances of the Scrollbar component and name them "textArea" and "textArea2". Increase the width of "textArea" to 200 pixels. Further place one CustomButton component on the timeline, name it myBut. Create a long MovieClip and name the class Clip. Embed a font like Arial rounded and name it ArialRounded. Then have an image ready in a folder named "icons". Change the image name appropriately. Place a button and name it "myBut". Create a css file, body.css and place in a folder named xml_files. Then create an Actionscript file, name it ScrollbarExample.as and place this script.
package 
{
	import flash.display.Sprite;
	import flash.display.MovieClip;
	import biz.flashscript.components.textarea.scrollBar.Scrollbar;
	import flash.text.TextField;
	import flash.text.TextFormat;
	import flash.events.Event;

	public class ScrollbarExample extends Sprite
	{
		private var firstClip:MovieClip;
		private var myText:TextField;
		private var firstScroll:Scrollbar;
		private var secondScroll:Scrollbar;
		
		public function ScrollbarExample ()
		{
			firstClip = new Clip ();
			firstClip.x = 50;
			firstClip.y = 80;
			addChild (firstClip);
			firstClip.visible = false;
			
			firstScroll = new Scrollbar();
			addChild(firstScroll);
			firstScroll.scrollDirection = "horizontal";
			firstScroll.visible = false;
			firstScroll.clipHeight = firstClip.height;
			firstScroll.clipWidth = 200;
			firstScroll.scrollType = "slider";
			firstScroll.barWidth = 3;
			firstScroll.displayObjectClip = firstClip;
			
			var format:TextFormat = new TextFormat();
			format.size = 20;
			format.color = 0xFF0000;
			
			myText = new TextField ();
			myText.x = 360;
			myText.y = 80;
			myText.multiline = true;
			myText.wordWrap = true;
			myText.width = 150;
			myText.autoSize = "left";
			
			myText.defaultTextFormat = format;
			addChild(myText);
			myText.visible = false;
			myText.text = "The Scrollbar component can be used for MovieClips and TextFields. The component has scrollbar or a slider function, which can be set by using the scrollType variable.";
			
			secondScroll = new Scrollbar();
			addChild(secondScroll);
			secondScroll.visible = false;
			secondScroll.clipHeight = 150;
			secondScroll.clipWidth = myText.width;
			secondScroll.scrollType = "scrollbar";
			secondScroll.classicTextClip = myText;
			secondScroll.addEventListener(Scrollbar.SCROLLER_ACTIVATED, scrollHandler);
		}
		private function scrollHandler (event:Event):void
		{
			firstScroll.visible = true;
			firstClip.visible = true;
			secondScroll.visible = true;
			myText.visible = true;
		}
	}
}
Get Adobe Flash player