欢迎光临
我们一直在努力

arrow flex是什么TextArea - AS3 Flex

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

TextArea is a text-entry control that lets users enter and edit
multiple lines of formatted text.

The skin for the Spark theme
uses the RichEditableText class. This means that the Spark TextArea control supports
the Text Layout Framework (TLF) library,
which builds on the Flash Text Engine (FTE).

In combination, these layers provide text editing with
high-quality international typography and layout.
The skin includes a scroller that can display horizontal and vertical scrollbars
for scrolling through the text and supports vertical scrolling with the mouse wheel.
The RichEditableText can be accessed as textDisplay
and the Scroller as scroller.

The skin for the mobile theme uses the StyleableStageText class.
Since StyleableStageText uses native text fields it allows for better text entry and
manipulation experiences on mobile devices however there are some
limitations and differences that you should consider.
Because StageText is not capable of measuring text, the TextArea must be given explicit,
percent-based, or constraint-based width and height.
The StyleableStageText can be accessed as textDisplay.
If you wish to use the TextField-based skin, rather than the
StageText-based skin, set the skinClass property to
"spark.skins.mobile.TextAreaSkin".

You can set the text to be displayed, or get the text that the user
has entered, using the text property.

The text is formatted using CSS styles such as fontFamily
and fontSize.

For the Spark theme, the widthInChars and heightInLines
properties let you specify the width and height of the TextArea
in a way that scales with the font size or you can use the typicalText property.
Note that if you use typicalText, the widthInChars and
heightInLines properties are ignored.
For all themes, you can also specify an explicit width or height in pixels,
or use a percent width and height or constraints such as
left and right
or top and bottom.

You can use the maxChars property to limit the number
of character that the user can enter, and the restrict
to limit which characters the user can enter.
To use this control for password input, set the
displayAsPassword property to true.

For the mobile theme, the soft-keyboard-specific properties, autoCapitalize,
autoCorrect, returnKeyLabel and softKeyboardType
properties specify keyboard hints.
If a soft-keyboard is present but does not support a feature represented by the
hint, the hint is ignored.
In mobile environments with only hardware keyboards, these hints are ignored.

Text Area for the Spark Theme

The most important differences between Spark TextArea and the
MX TextArea control are as follows:

  • Spark TextArea offers better typography, better support
    for international languages, and better text layout.
  • Spark TextArea has an object-oriented model of rich text,
    while the MX version does not.
  • Spark TextArea has better support for displaying
    large amounts of text.
  • Spark TextArea requires that fonts be embedded
    differently than the MX version.
    To learn how to use the
    embedAsCFF attribute when you embed a font,
    see the font documentation.

The Spark TextArea control uses the TLF object-oriented model of rich text,
in which text layout elements such as divisions, paragraphs, spans,
hyperlinks, and images are represented at runtime by ActionScript
objects. You can programmatically access and manipulate these objects.
The central object in TLF for representing rich text is a
TextFlow. Specify rich text for a TextArea control
by setting its textFlow property to a TextFlow instance.

If you don’t need to display text that has multiple formats,
set the TextArea text property to a plain text string.
See the descriptions of the text and textFlow
properties for information about how they interact;
for example, you can set one and get the other.

At compile time, you can put TLF markup tags inside
the TextArea tag, as the following example shows:

  <s:TextArea>Hello <s:span fontWeight="bold">World!</s:span></s:TextArea>
  

In this example, the MXML compiler sets the TextArea content
property, causing a TextFlow object to be created from the FlowElements that you specify.

The TextArea control does not include any user interface for changing
the formatting of the text but contains
APIs that you can use to programmatically format text.
For example, you can create a
a button that, when clicked, makes the selected text bold.

The default text formatting is determined by CSS styles
such as fontFamily
and fontSize.
Any formatting information in the TextFlow object overrides
the default formatting provided by the CSS styles.

You can control many characteristics of TextArea content with styles. Here
are a few popular ones:

  • Control spacing between lines with the
    lineHeight style.
  • Control the spacing between paragraphs with the
    paragraphSpaceBefore and paragraphSpaceAfter styles.
  • Align or justify text using the textAlign and textAlignLast styles.
  • Inset text from the border of the control using the paddingLeft, paddingTop,
    paddingRight, and paddingBottom styles.

By default, the text wraps at the right edge of the control.
A vertical scrollbar automatically appears when there is more
text than fits in the TextArea.
If you set the lineBreak style to explicit,
new lines start only at explicit line breaks. This has the same effect as
if you use CR (
), LF (
),
or CR+LF (
) in text,
or if you use <p> and <br/>
in TLF markup.
In those cases, a horizontal scrollbar automatically appears
if any lines of text are wider than the control.

The Spark TextArea
can display left-to-right (LTR) text, such as French,
right-to-left (RTL) text, such as Arabic, and bidirectional text,
such as a French phrase inside of an Arabic one.
If the predominant text direction is right-to-left,
set the direction style to rtl.
The textAlign style defaults to start,
which makes the text left-aligned when direction
is ltr and right-aligned when direction
is rtl. To get the opposite alignment,
set textAlign to end.

The Spark TextArea also supports
unlimited undo/redo within one editing session.
An editing session starts when the control gets keyboard focus
and ends when the control loses focus.

To use this component in a list-based component, such as a List or DataGrid,
create an item renderer.
For information about creating an item renderer, see

Custom Spark item renderers.

For the Spark theme, the TextArea control has the following default characteristics:

For the Mobile theme, the TextArea control has the following default characteristics:

expandedMXML 구문 숨기기

The <s:TextArea> tag inherits all of the tag
attributes of its superclass and adds the following tag attributes:

  <s:TextArea
    Properties
    heightInLines="Calculated default"  [Spark theme only]
    textFlow="TextFlow"  [Spark theme only]
    typicalText=null  [Spark theme only]
    widthInChars="Calculated default"  [Spark theme only]

    Styles
    horizontalScrollPolicy="auto"  [Spark theme only]
    symbolColor=""
    verticalScrollPolicy="auto"  [Spark theme only]
  />
  

content

예제 보기


스타일은 일반적이거나 특정 테마와 연결되어 있을 수 있습니다. 일반적인 스타일인 경우 모든 테마와 함께 사용할 수 있지만, 특정 테마와 연결된 스타일인 경우 응용 프로그램이 해당 테마를 사용하는 경우에만 스타일을 사용할 수 있습니다.

  스타일 설명 정의 주체 String 예
언어 버전: ActionScript 3.0
 제품 버전: Flex 4
 런타임 버전: Flash10, AIR 1.5

Specifies which element baseline snaps to the alignmentBaseline to determine the vertical position of the element on the line. String 아니요
언어 버전: ActionScript 3.0
 제품 버전: Flex 4
 런타임 버전: Flash10, AIR 1.5

Indicates under what conditions the horizontal scroll bar is displayed.

For the Mobile theme, this is not supported.

Indicates under what conditions the horizontal scroll bar is displayed.

  • ScrollPolicy.ON (“on”) – the scroll bar is always displayed.
  • ScrollPolicy.OFF (“off”) – the scroll bar is never displayed.
    The viewport can still be scrolled programmatically, by setting its
    horizontalScrollPosition property.
  • ScrollPolicy.AUTO (“auto”) – the scroll bar is displayed when
    the viewport’s contentWidth is larger than its width.

The scroll policy affects the measured size of the Scroller component.

Number length 예
언어 버전: ActionScript 3.0
 제품 버전: Flex 4
 런타임 버전: Flash10, AIR 1.5

This specifies an auto indent for the start edge of lists when the padding value of the list on that side is auto. String 아니요
언어 버전: ActionScript 3.0
 제품 버전: Flex 4
 런타임 버전: Flash10, AIR 1.5

Indicates under what conditions the vertical scroll bar is displayed.

For the Mobile theme, this is not supported.

Indicates under what conditions the vertical scroll bar is displayed.

  • ScrollPolicy.ON (“on”) – the scroll bar is always displayed.
  • ScrollPolicy.OFF (“off”) – the scroll bar is never displayed.
    The viewport can still be scrolled programmatically, by setting its
    verticalScrollPosition property.
  • ScrollPolicy.AUTO (“auto”) – the scroll bar is displayed when
    the viewport’s contentHeight is larger than its height.

The scroll policy affects the measured size of the Scroller component.

content:Object

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

This property is intended for use in MXML at compile time;
to get or set rich text content at runtime,
use the textFlow property instead. Adobe recommends using
textFlow property to get and set rich text content at runtime,
because it is strongly typed as a TextFlow rather than as an Object.
A TextFlow is the canonical representation
for rich text content in the Text Layout Framework.

The content property is the default property
for TextArea, so that you can write MXML, as the following example shows:

      <s:TextArea>Hello <s:span fontWeight="bold">World</s:span></s:TextArea>
      

In this example, the String and SpanElement that you specify
as the content are used to create a TextFlow.

This property is typed as Object because you can set it to
to a String, a FlowElement, or an Array of Strings and FlowElements.
In the example above, the content is
a 2-element array. The first array element is the String
“Hello”. The second array element is a SpanElement object with the text
“World” in boldface.

No matter how you specify the content, the content is converted
to a TextFlow object. When you get the value of this property, you get
the resulting TextFlow object.

For the Mobile theme, this is not supported.

    public function get content():Object
    public function set content(value:Object):void

heightInLines:Number

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

The default height of the control, measured in lines.

For the Spark theme, see
spark.components.RichEditableText.heightInLines

For the Mobile theme, this is not supported.

기본값: NaN.

    public function get heightInLines():Number
    public function set heightInLines(value:Number):void

textFlow:flashx.textLayout.elements:TextFlow

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

The TextFlow representing the rich text displayed by this component.

For the Spark theme, see
spark.components.RichEditableText.textFlow

For the Mobile theme, this is not supported.

기본값: null.

    public function get textFlow():flashx.textLayout.elements:TextFlow
    public function set textFlow(value:flashx.textLayout.elements:TextFlow):void

widthInChars:Number

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

The default width of the control, measured in em units.

For the Spark theme, see
spark.components.RichEditableText.widthInChars

For the Mobile theme, this is not supported.

기본값: NaN.

    public function get widthInChars():Number
    public function set widthInChars(value:Number):void

public function TextArea()

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

Constructor.

public function getFormatOfRange(requestedFormats:Vector.<String> = null, anchorPosition:int = -1, activePosition:int = -1):flashx.textLayout.formats:TextLayoutFormat

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

Returns a TextLayoutFormat object specifying the computed formats
for the specified range of characters.

If a format is not consistently set across the entire range,
its value will be undefined.

You can specify a Vector of Strings containing the names of the
formats that you care about; if you don’t, all formats
will be computed.

If you don’t specify a range, the selected range is used.

:Vector.<String> (default = null) — A Vector of Strings specifying the names
of the requested formats, or null to request all formats.

:int (default = -1) — A character position specifying
the fixed end of the selection.

:int (default = -1) — A character position specifying
the movable end of the selection.

flashx.textLayout.formats:TextLayoutFormat — A TextLayoutFormat object.

public function scrollToRange(anchorPosition:int = 0, activePosition:int):void

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

컨테이너에 해당 텍스트 범위가 표시되도록 스크롤합니다.

:int (default = 0) — The end of the selection that is changed when you extend the selection. It can be
either the start or the end of the selection, expressed as an offset from the start of the text flow. :int (default = NaN) — The stable end of the selection when you extend the selection. It can be either
the start or the end of the selection.

public function setFormatOfRange(format:flashx.textLayout.formats:TextLayoutFormat, anchorPosition:int = -1, activePosition:int = -1):void

언어 버전:  ActionScript 3.0
제품 버전:  Flex 4
런타임 버전:  Flash Player 10, AIR 1.5

Applies the specified formats to each element in the specified
range that correspond to the given format.
It applies the character formats to the text in the specified range
(no change is made if the specified range is a single point).
It applies the paragraph formats to any paragraphs at least
partially within the range (or a single paragraph if the range is a
single point).
It applies the container formats to the container.

The supported formats are those in TextLayoutFormat.
A value of undefined does not get applied.
If you don’t specify a range, the selected range is used.

The following example sets the fontSize and color of the selection:

          var textLayoutFormat:TextLayoutFormat = new TextLayoutFormat();
          textLayoutFormat.fontSize = 12;
          textLayoutFormat.color = 0xFF0000;
          myRET.setFormatOfRange(textLayoutFormat);
          

If you use the results of getFormatOfRange() to
specify the format, note that every format in the
TextLayoutFormat has a
computed value, which will be applied to each element that
corresponds to the given format.

If you would like to specify a format to be applied to all the text
it would be better to use setStyle(format, value)
on the component itself.

The following example sets the fontSize and color of all the text:

          myRET.setStyle("fontSize", 12);
          myRET.setStyle("color", 0xFF0000);
          

:flashx.textLayout.formats:TextLayoutFormat — The TextLayoutFormat to apply to the selection.

:int (default = -1) — A character position, relative to the beginning of the
text String, specifying the end of the selection that stays fixed when the
selection is extended with the arrow keys.

:int (default = -1) — A character position, relative to the beginning of the
text String, specifying the end of the selection that moves when the
selection is extended with the arrow keys.

<?xml version="1.0" encoding="utf-8"?>
<!-- Simple example to demonstrate the Spark TextArea control. -->
<s:Application xmlns:fx="http://ns.adobe.com/mxml/2009"
        xmlns:s="library://ns.adobe.com/flex/spark">
    <s:layout>
        <s:BasicLayout />
    </s:layout>

    <s:Panel title="Spark TextArea Control Example"
            horizontalCenter="0"
            verticalCenter="0">
        <s:VGroup left="10" right="10" top="10" bottom="10">
            <s:TextArea width="400" height="100">
                <s:text>This is a multiline, editable Spark TextArea control. If you need a non-editable multiline control, use the Text control.</s:text>
            </s:TextArea>
            <s:TextArea width="400" height="100">
                <s:content>This is <s:span color="#FF0000">HTML text</s:span>
                    in an <s:span fontWeight="bold">Spark TextArea control</s:span>.
                    Use the <s:span textDecoration="underline">content</s:span> property
                    of the <s:span color="#008800">Spark TextArea control</s:span> 
                    to include basic HTML markup in your text, including
                    <s:a href="http://www.adobe.com" target="_blank">links</s:a>.</s:content>
            </s:TextArea>
        </s:VGroup>
    </s:Panel>

</s:Application>


赞(0)
未经允许不得转载:上海聚慕医疗器械有限公司 » arrow flex是什么TextArea - AS3 Flex

登录

找回密码

注册