CustomTextArea (ONLY commercially available)

Package:
Class:
Inheritance:
biz.flashscript.components.textarea
public class CustomTextArea
AbstractClass extends Sprite
The CustomTextArea class is used for the CustomTextArea component. To create an instance of the CustomTextArea use the constructor new CustomTextArea(). The difference to the UI TextArea component is that styling of the skins is easier and a css stylesheet can be applied. Further it comes with a scrollbar with different ways to scroll. To create an instance of the CustomTextArea use the constructor new CustomTextArea().
Public Properties
Property Defined By
cssUrl : String
Specifies the url for a css stylesheet.
CustomTextArea
_condenseWhite : Boolean
Specifies, if the text may contain white space.
CustomTextArea
embFont : Font
Specifies whether to embed fonts.
CustomTextArea
editable : Boolean
Specifies whether the textfield is editable.
CustomTextArea
txtHeight : int
Specifies the height of the TextField and the mask.
CustomTextArea
txtWidth : int
Specifies the width of the TextField and the mask.
CustomTextArea
scrollWidth : int
Specifies the width of the Scrollbar.
CustomTextArea
bGround : Boolean
Specifies if background color can be set.
CustomTextArea
bgColor : uint
Specifies the background color.
CustomTextArea
fieldBorder : Boolean
Specifies if a border can be set.
CustomTextArea
bdColor : uint
Specifies the border color.
CustomTextArea
textFormat : TextFormat
Sets the TextFormat for the TextField.
CustomTextArea
scrollType : String
Specifies the bar type.
CustomTextArea
textContent : String
Specifies the text for the TextField.
CustomTextArea
Public Methods
Method Defined By
CustomTextArea()
Creates a new instance of the CustomTextArea component.
CustomTextArea
textAddition(tValue:String, plus:Boolean)
Specifies the string displayed in the TextField.
CustomTextArea
Events
Event Defined By
All inherited events for the Sprite class.
Property Detail
cssUrl property
cssUrl:String [read-write]

This specifies the path for a css Stylesheet.

There is default value. .

.

Implementation

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

_condenseWhite property
_condenseWhite:Boolean [read-write]

Specifies whether there is white space.

The default value is false.

.

Implementation

public function get _condenseWhite():Boolean
public function set _condenseWhite(value:Boolean):void

embFont property
embFont:Font [read-write]

Specifies whether to embed fonts. The embedded fonts have to be defined by a css stylesheet or by a TextFormat script.

The default value is null.

.

Implementation

public function get embFont():Font
public function set embFont(value:Font):void

editable property
editable:Boolean [read-write]

Specifies whether the textfield is editable.

The default value is false.

.

Implementation

public function get editable():Boolean
public function set editable(value:Boolean):void

txtHeight property
txtHeight:int [read-write]

Specifies the height of the TextField and the mask.

The default value is 100. The height can also be changed by placing a hard copy of the component on the timeline and changing its height manually.

Implementation

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

txtWidth property
txtWidth:int [read-write]

Specifies the width of the TextField and the mask.

The default value is 100. The width can also be changed by placing a hard copy of the component on the timeline and changing its width manually.

Implementation

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

scrollWidth property
scrollWidth:int [read-write]

Specifies the width of the Scrollbar.

The default value is 22.

Implementation

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

bGround property
bGround:Boolean [read-write]

Specifies possible background color of the textfield.

The default value is false.

Implementation

public function get bGround():Boolean
public function set bGround(value:Boolean):void

bgColor property
bgColor:uint [read-write]

Specifies the background color of the textfield.

The default value is 0xFFFFFF.

Implementation

public function get bgColor():uint
public function set bgColor(value:uint):void

fieldBorder property
fieldBorder:Boolean [read-write]

Specifies possible border color of the textfield.

The default value is false.

Implementation

public function get fieldBorder():Boolean
public function set fieldBorder(value:Boolean):void

bdColor property
bdColor:uint [read-write]

Specifies the border color of the textfield.

The default value is 0xCCCCCC.

Implementation

public function get bdColor():uint
public function set bdColor(value:uint):void

textFormat property
textFormat:TextFormat [read-write]

This defines a new TextFormat for the TextField.

Implementation

public function get textFormat():TextFormat
public function set textFormat(value:TextFormat):void

scrollType property
scrollType:String [read-write]

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

The default value is "scrollbar".

Implementation

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

textContent property
textContent:String [read-write]

This specifies the text of the TextField instance. The textContent can also be added using the textAddition(tValue:String) method.

There is no default value specified.

Implementation

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

textAddition ()  method
public function textAddition(tValue:String, plus:Boolean=false)

This method will display the specified text in the TextField.

Parameters

  • tValue:String ____ Specifies the text displayed in the TextField.
  • plus:String ____ Optional: specifies whether the text will be added to existing text. Default is false.
Examples
Create a new fla file and name it CustomTextAreaExample.fla. Place the fla in the same folder as the biz folder. Create two instances of the CustomTextArea 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. 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 CustomTextAreaExample.as and place this script.
package 
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.text.*;
	import flash.net.URLRequest;
	import flash.net.URLLoader;
	import flash.events.MouseEvent;
	import biz.flashscript.components.textarea.CustomTextArea;
	import biz.flashscript.components.buttons.CustomButton;

	public class CustomTextAreaExample extends Sprite
	{
		public var textArea:CustomTextArea;
		public var textArea2:CustomTextArea;
		public var myBut:CustomButton;
		private var textValue1:String;

		public function CustomTextAreaExample ():void
		{
			var myFont:Font = new ArialRounded ();
			var format:TextFormat = new TextFormat  ;
			format.align = TextFormatAlign.CENTER;
			format.color = 0xFF0000;
			format.font = myFont.fontName;
			format.size = 16;
			
			textArea.scrollType = "slider";
			textArea.embFont = myFont;
			textArea.textFormat = format;
			textArea.editable = true;
			textArea.textAddition ("This is a working text.");
			myBut.label = "Press Button";
			myBut.addEventListener (MouseEvent.CLICK,clickHandler);
			
			textArea2.txtWidth = 200;
			textArea2.cssUrl = "xml_files/body.css";
			var urlRequest:URLRequest = new URLRequest("xml_files/susan.xml");
			var urlLoader:URLLoader = new URLLoader();
			urlLoader.addEventListener (Event.COMPLETE, loadFinished);
			urlLoader.load (urlRequest);
		}
		private function clickHandler (e:MouseEvent):void
		{
			trace ("clicked");
			textValue1 = "<img src='icons/news.gif' vspace='0' hspace='2'/><br/>This is image 1. If the text is larger 
			the scrollbar will be activated as in this example.";
			textArea.textAddition (textValue1);
			textArea2.textAddition ("<h1>TEXTAREA 2 headline</h1><br/>",true);
			textArea2.textAddition ("The second textarea has a new text.<br/>",true);
			textArea2.textAddition ("The second textarea has a very different text.",true);
		}
		private function loadFinished (ev:Event)
		{
			var myXML:XML = new XML(ev.currentTarget.data);
			var myText:String = myXML.p.toString();
			textArea2.textAddition ("<h1>TEXTAREA 2</h1> headline<br/>",true);
		}
	}
}
Get Adobe Flash player