Flex-textarea-control
フレックス-TextAreaコントロール
前書き
TextAreaコントロールは、ユーザーが複数行の書式付きテキストを入力および編集できるようにするテキスト入力コントロールです。
クラス宣言
以下は spark.components.TextArea クラスの宣言です-
public class TextArea
extends SkinnableTextBase
パブリックプロパティ
Sr.No | Properties & Description |
---|---|
1 |
content : Object このプロパティは、コンパイル時にMXMLで使用するためのものです。実行時にリッチテキストコンテンツを取得または設定するには、代わりにtextFlowプロパティを使用します。 |
2 |
heightInLines : Number 行単位で測定されたコントロールのデフォルトの高さ。 |
3 |
textFlow : flashx.textLayout.elements:TextFlow このコンポーネントによって表示されるリッチテキストを表すTextFlow。 |
4 |
widthInChars : Number em単位で測定されたコントロールのデフォルトの幅。 |
パブリックメソッド
Sr.No | Method & Description |
---|---|
1 |
TextArea() コンストラクタ。 |
2 |
getFormatOfRange (requestedFormats:Vector.<String> = null, anchorPosition:int = -1, activePosition:int = 1):flashx.textLayout.formats:TextLayoutFormat 指定された文字範囲の計算された形式を指定するTextLayoutFormatオブジェクトを返します。 |
3 |
scrollToRange(anchorPosition:int = 0, activePosition:int):void テキスト範囲がコンテナに表示されるようにスクロールします。 |
4 |
setFormatOfRange (format:flashx.textLayout.formats:TextLayout Format, anchorPosition:int = -1, activePosition:int = -1):void 指定された形式に対応する指定された範囲内の各要素に、指定された形式を適用します。 |
継承されるメソッド
このクラスは、次のクラスからメソッドを継承します-
- spark.components.supportClasses.SkinnableTextBase
- spark.components.supportClasses.SkinnableComponent
- mx.core.UIComponent
- mx.core.FlexSprite
- flash.display.Sprite
- flash.display.DisplayObjectContainer
- flash.display.InteractiveObject
- flash.display.DisplayObject
- flash.events.EventDispatcher
- 対象
Flex TextAreaコントロールの例
テストアプリケーションを作成して、FlexアプリケーションでTextAreaコントロールの使用を確認するには、次の手順に従います。
Step | Description |
---|---|
1 | Create a project with a name HelloWorld under a package com.finddevguides.client as explained in the Flex - Create Application chapter. |
2 | Modify HelloWorld.mxml as explained below. Keep rest of the files unchanged. |
3 | Compile and run the application to make sure business logic is working as per the requirements. |
以下は、変更されたmxmlファイル src/com.finddevguides/HelloWorld.mxml の内容です。
<?xml version = "1.0" encoding = "utf-8"?>
<s:Application xmlns:fx = "http://ns.adobe.com/mxml/2009"
xmlns:s = "library://ns.adobe.com/flex/spark"
xmlns:mx = "library://ns.adobe.com/flex/mx"
width = "100%" height = "100%" minWidth = "500" minHeight = "500">
<fx:Style source = "/com/finddevguides/client/Style.css"/>
<s:BorderContainer width = "550" height = "400" id = "mainContainer"
styleName = "container">
<s:VGroup width = "100%" height = "100%" gap = "50"
horizontalAlign = "center" verticalAlign = "middle">
<s:Label id = "lblHeader" text = "Form Controls Demonstration"
fontSize = "40" color = "0x777777" styleName = "heading"/>
<s:Panel id = "textAreaPanel" title = "Using TextArea"
width = "420" height = "200">
<s:layout>
<s:VerticalLayout gap = "10" verticalAlign = "middle"
horizontalAlign = "center"/>
</s:layout>
<s:TextArea width = "400" height = "100">
<s:content>
This is <s:span color = "#FF0000">HTML text</s:span>
in an <s:span fontWeight = "bold">TextArea control</s:span>.
<s:span textDecoration = "underline">content</s:span> property
of the <s:span color = "#008800">TextArea control</s:span>
can be used to include basic HTML markup in including
<s:a href = "http://www.finddevguides.com"
target = "_blank">links</s:a>.
</s:content>
</s:TextArea>
</s:Panel>
</s:VGroup>
</s:BorderContainer>
</s:Application>
すべての変更が完了したら、link:/flex/flex_create_application [Flex-アプリケーションの作成]の章で行ったように、アプリケーションを通常モードでコンパイルして実行します。 アプリケーションに問題がない場合は、次の結果が生成されます。