| Flashscript classes (ActionScript 3) | Home | MX | MX 2004 | Flash 8 | Flash 9 |Flash 10 |PHP |Components | Snippets | Contact | |
CustomTextArea |
|
|
| Property | Defined By |
|---|---|
|
cssUrl
: String
This is the url for a css stylesheet. |
CustomTextArea |
|
embFont
: Boolean
Specifies whether to embed fonts. |
CustomTextArea |
|
myHeight
: int
Sets the height of the TextField. |
CustomTextArea |
|
myTextFormat
: TextFormat
Sets the TextFormat for the TextField. |
CustomTextArea |
|
myWidth
: int
Sets the width of the TextField. |
CustomTextArea |
|
textValue
: String
Specifies the text for the TextField. |
CustomTextArea |
| Method | Defined By |
|---|---|
|
CustomTextArea()
Creates a new instance of the CustomTextArea component. |
CustomTextArea |
|
textAddition(tValue:String)
Will add the string specified by the parameter to the TextField. |
CustomTextArea |
| 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. . .Implementationpublic function get cssUrl():Stringpublic function set cssUrl(value:String):void |
|
embFont property embFont:Boolean [read-write] Specifies whether to embed fonts. The embedded fonts have to be defined by a css stylesheet or there will be no text displayed. The default value is false. .Implementationpublic function get embFont():Booleanpublic function set embFont(value:Boolean):void |
|
myHeight property myHeight:int [read-write] This defines the height of the TextField. There is no default value specified. The height is determined by the original size of the component instance, which is 100 pixel. The height can be changed by Actionscript or by placing a hard copy of the component on the timeline and changing its height manually. Implementationpublic function get myHeight():intpublic function set myHeight(value:int):void |
|
myTextFormat property myTextFormat:TextFormat [read-write] This defines a new TextFormat for the TextField. Implementationpublic function get myTextFormat():TextFormatpublic function set myTextFormat(value:TextFormat):void |
|
myWidth property myWidth:int [read-write] This defines the width of the TextField. There is no default value specified. The width is determined by the original size of the component instance, which is 100 pixel. The width can be changed by Actionscript or by placing a hard copy of the component on the timeline and changing its width manually. Implementationpublic function get myWidth():intpublic function set myWidth(value:int):void |
|
textValue property textValue:String [read-write] This specifies the text of the TextField instance. The textValue can also be added using the textAddition(tValue:String) method. There is no default value specified. Implementationpublic function get textValue():Stringpublic function set textValue(value:String):void |
| Constructor Detail |
|---|
|
CustomTextArea () Constructor
public function CustomTextArea() |
| Intializes a new CustomTextArea instance. |
| Method Detail |
|---|
|
textAddition () method
This method will display the specified text in the TextField. This method is useful, when the text of the textArea component is manually changed by a Button event for example. |
Parameters
|
| 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". Set a size height smaller than the image. Then have the image ready in a folder named "icons". Change the image name appropriately. Place a button and name it "myBut". 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;
public class CustomTextAreaExample extends Sprite
{
private var textValue1:String;
public function CustomTextAreaExample ():void
{
var format:TextFormat = new TextFormat();
format.font = "Verdana";
format.color = 0xFF0000;
format.size = 16;
textArea.myTextFormat = format;
textArea.textAddition ("This is a working text.");
myBut.label = "Press Button";
myBut.addEventListener (MouseEvent.CLICK,clickHandler);
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 ("TEXTAREA 2 headline<br/>",true);
}
}
}
|