mx.controls
Text クラス

Text クラス
mx.controls.Label の拡張Text コントロールは複数行の編集不可能なテキストを表示します。Text コントロールはスクロールバーをサポートしません。このコントロールの推奨サイズは、指定したテキストを表示するのに十分な大きさです。
Text コントロールでは、HTML テキストと、さまざまなテキストおよびフォントスタイルをサポートしています。テキストは必ずコントロールの境界で折り返され、コントロールの上端に揃えられます。Text コントロールは透明なので、コンポーネントのコンテナの背景が透けて表示されます。また、コントロールの境界線はありません。
MXML シンタックス
<mx:Text> タグは、親クラスのすべてのプロパティを継承し、次のプロパティを定義します。
<mx:Text
marginTop="0"
marginBottom="0"
selectable="true|false"
/>
例を参照するにはここをクリックしてください
関連項目
Label
TextInput
TextArea
| className:String
このクラスの名前です。 |
| selectable:Boolean
テキストの選択を許可する場合は true、許可しない場合は false を指定します。 |
static | version:String
このクラスのバージョンを表すストリングです。 |
marginBottom | 型 : Number 形式 : Length CSS の継承 : なし
コントロールの下の境界とコンテンツ領域との間のピクセル数です。デフォルト値は 0 です。 |
marginTop | 型 : Number 形式 : Length CSS の継承 : なし
コントロールの上の境界とコンテンツ領域との間のピクセル数です。デフォルト値は 0 です。 |
className
className:String
このクラスの名前です。
selectable
selectable:Boolean
テキストの選択を許可する場合は true、許可しない場合は false を指定します。テキストを選択可能にすると、テキストをコピーおよびペーストできます。デフォルト値は true です。
version
static version:String
このクラスのバージョンを表すストリングです。
| TextExample.mxml |
<?xml version="1.0"?>
<!-- Text コントロールの使用方法を示す簡単な例 -->
<mx:Application xmlns:mx="http://www.macromedia.com/2003/mxml" backgroundColor="#FFFFFF">
<mx:Script>
<![CDATA[
var sampleText= "The Text control displays multiline, noneditable text." +
"The Text control does not support scroll bars; its preferred size is a square large enough to display " +
"the specified text. " +
" The Text control supports HTML text and a variety of text and font styles. " +
"The text always wraps at the control boundaries, and is always aligned at the top of the control." +
"The Text control is transparent so that the background of the component's container shows through," +
"and the control has no borders." ;
function showOutput()
{
textoutput.text= "Text Format:" + sampleText;
}
function clearText()
{
textoutput.text="";
}
]]>
</mx:Script>
<mx:Panel title="Text Panel" marginTop="10">
<mx:Text id="textoutput" text="Text control output will be displayed here." width="295" height="135"
color="#0000FF"/>
<mx:HBox>
<mx:Button label="Press Enter" click="showOutput();"/>
<mx:Button label="Clear" click="clearText();"/>
</mx:HBox>
</mx:Panel>
</mx:Application>
|