Flashscript classes (ActionScript 3) | Home | MX | MX 2004 | Flash 8 | Flash 9 |Flash 10 |PHP |Components | Snippets | Contact |

McScrollBar_vert

Package:
Class:
Inheritance:
biz.flashscript.components.textarea.Scrollbar
public class McScrollBar_vert
Sprite
The McScrollBar_vert class allows to attach a scrollbar to a MovieClip. To trigger that use the constructor new McScrollBar_vert() and add parameters as desired. All parameters are required.
Public Properties
Property Defined By
All inherited properties of the Sprite class. N/A
Public Methods
Method Defined By
McScrollBar_vert()
Constructor.
McScrollBar_vert
Method Defined By
arrangeStage(moMclip:Sprite, moMask:Sprite, mBar:Sprite, mScrollerBar:Sprite):void
Method will intiate the scrollbar functions..
McScrollBar_vert
Method Defined By
adjustScroll():void
Will adjust the scrollbar when not in o position.
McScrollBar_vert
Events
Event Defined By
All inherited events for the Sprite class.
Constructor Detail
McScrollBar_vert ()  Constructor
public function McScrollBar_vert ()
Creates a new instance of the McScrollBar_vert.
Method Detail

arrangeStage()  method
public function arrangeStage(moMclip:Sprite, moMask:Sprite, mBar:Sprite, mScrollerBar:Sprite):void

This method is required to initiate the scrollbar and adjusting it to the textfield.

Parameters

  • moMclip:Sprite ____ Specifies an empty Sprite.
  • moMask:Sprite ____ Specifies a Sprite used as mask (MyMask class).
  • mBar:Sprite ____ Specifies the shell for the Scrollbar (BarShell class).
  • mScrollerBar:Sprite ____ Specifies the actual Scrollerbar (Scrollerbar class).

adjustScroll ()  method
public function adjustScroll():void

This method will adjust the scrollbar back to its original position.

Examples
Create a new fla file and name it ScrollbarExample.fla. Place the fla in the same folder as the biz folder. Add the folder from the McScrollBar_vert.fla file in the library of your fla. Then create an Actionscript file, name it ScrollbarExample.as and place this script.
package 
{
	import biz.flashscript.components.textarea.scrollBar.McScrollBar_vert;
	import flash.display.Sprite;
	import flash.text.TextField;

	public class ScrollbarExample extends Sprite
	{
		public function ScrollbarExample ()
		{
			var textHolder:Sprite = new Sprite ();
			textHolder.x = 50;
			textHolder.y = 50;
			addChild (textHolder);

			var scrollHolder:Sprite = new Sprite();
			textHolder.addChild (scrollHolder);

			var myText:TextField = new TextField ();
			myText.autoSize = "left";
			myText.width = 195;
			myText.border = true;
			myText.borderColor = 0x666666;
			myText.background = true;
			myText.backgroundColor = 0xF1F5F9;
			myText.multiline = true;
			myText.wordWrap = true;
			myText.htmlText = 'Yesterday I got a letter from my aunt Mary.  At least the return address said so.  But I was suspicious because one has to be careful with letters, Bioterrorism, you know?  I looked at the letter from all sides.  Yeah, there it was, a bulge, most probably powder: ANTHRAX! My God, I was frightened.  I put the letter down immediately and washed my hands and rushed to get latex gloves.  Horrible thoughts went through my mind about the bugs in the letter and how they are multiplying in my bloodstream, Yuk.  Should I call 911 or better the FBI?  Who else knew my aunts address?  But most important of all, why and why me?  Who hated me so much to send me a letter with deadly bacteria?  Actually I am a popular guy.  Yeah, thats it.  Somebody is jealous about my popularity, somebody with a microbiology background or a connection to foreign terrorists.  I dont know any more, I dont know.  Stay calm, just stay calm.  I took the letter very carefully and put it in a plastic bag. Then I drove to a nearby river and.....got rid of it, haaaa. (Cell phone rings.) Hello, aunt Mary.....for my birthday.....200 bucks in cash!';

			scrollHolder.addChild (myText);

			var textCover:MyMask = new MyMask();
			textCover.width = 200;
			textCover.height = 100;
			textCover.visible = false;
			textHolder.addChild (textCover);
			scrollHolder.mask = textCover;

			var myBar:BarShell = new BarShell();
			myBar.x = textCover.x + textCover.width;
			myBar.y = textCover.y;
			myBar.width = 10;
			myBar.height = textCover.height;
			myBar.visible = false;
			textHolder.addChild (myBar);

			var scBar:McScrollBar_vert = new McScrollBar_vert();
			scBar.visible = false;
			textHolder.addChild (scBar);

			var myScrollerBar:ScrollerBar = new ScrollerBar();
			scBar.addChild (myScrollerBar);
			scBar.arrangeStage (scrollHolder, textCover, myBar, myScrollerBar);
		}
	}
}