Adobe® Flex® 4 Language Reference
Show Packages and Classes List |  Packages  |  Classes  |  Index  |  Appendixes
flash.text.ime 
IIMEClient 
Packageflash.text.ime
Interfacepublic interface IIMEClient

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Interface for IME (input method editor) clients. Components based on the flash.text.engine package must implement this interface to support editing text inline using an IME. This interface is not used with TextField objects. TextLayoutFramework (TLF) uses this interface to support inline IME, so clients using TLF do not need to implement this interface.

To support inline IME, set the imeClient property of an ImeEvent.IME_START_COMPOSITION event to an object which implements this interface.

The following terms are often used in the IME related API:

  • A conversation is the interchange between the IME and the application. During a conversation, a composition is updated one or more times and then confirmed by the user.
  • A composition identifies the text entered by the user through the IME; including associated input state information such as the selected range and the extent of any clauses.
  • A clause is a range of the composition possibly sharing semantic information, such as indicating whether the input is in a selected or converted state. A composition contains zero or more clauses.

See also



Public Properties
 PropertyDefined By
  compositionEndIndex : int
[read-only] The zero-based character index value of the end of the current edit session text (such as all text in the inline session that is not confirmed to the document).
IIMEClient
  compositionStartIndex : int
[read-only] The zero-based character index value of the start of the current edit session text (such as all text in the inline session that is not confirmed to the document).
IIMEClient
  selectionActiveIndex : int
[read-only] The zero-based character index value of the last character in the current selection.
IIMEClient
  selectionAnchorIndex : int
[read-only] The zero-based character index value of the first character in the current selection.
IIMEClient
  verticalTextLayout : Boolean
[read-only] Indicates whether the text in the component is vertical or not.
IIMEClient
Public Methods
 MethodDefined By
  
confirmComposition(text:String = null, preserveSelection:Boolean = false):void
Use this callback to end the inline editing session and confirm the text.
IIMEClient
  
getTextBounds(startIndex:int, endIndex:int):Rectangle
The IME uses this method to query the bounding box of the text currently edited with the IME client.
IIMEClient
  
getTextInRange(startIndex:int, endIndex:int):String
Gets the specified range of text from the component.
IIMEClient
  
selectRange(anchorIndex:int, activeIndex:int):void
Sets the range of selected text in the component.
IIMEClient
  
updateComposition(text:String, attributes:Vector.<CompositionAttributeRange>, compositionStartIndex:int, compositionEndIndex:int):void
Callback for updating the contents of the inline editing session.
IIMEClient
Events
 Event Summary Defined By
  Dispatched when the user begins to use an IME (input method editor).IIMEClient
  Dispatched when the user enters text.IIMEClient
Property Detail

compositionEndIndex

property
compositionEndIndex:int  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

The zero-based character index value of the end of the current edit session text (such as all text in the inline session that is not confirmed to the document).



Implementation
    public function get compositionEndIndex():int

compositionStartIndex

property 
compositionStartIndex:int  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

The zero-based character index value of the start of the current edit session text (such as all text in the inline session that is not confirmed to the document).



Implementation
    public function get compositionStartIndex():int

selectionActiveIndex

property 
selectionActiveIndex:int  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

The zero-based character index value of the last character in the current selection.



Implementation
    public function get selectionActiveIndex():int

selectionAnchorIndex

property 
selectionAnchorIndex:int  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

The zero-based character index value of the first character in the current selection.



Implementation
    public function get selectionAnchorIndex():int

verticalTextLayout

property 
verticalTextLayout:Boolean  [read-only]

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Indicates whether the text in the component is vertical or not. This property directs the positioning of the candidate window (such as beside vertical text or below horizontal text).



Implementation
    public function get verticalTextLayout():Boolean
Method Detail

confirmComposition

()method
public function confirmComposition(text:String = null, preserveSelection:Boolean = false):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Use this callback to end the inline editing session and confirm the text.

Parameters

text:String (default = null) — the final state of the text in the inline session (the confirmed text).
 
preserveSelection:Boolean (default = false) — when true, you should not reset the current selection to the end of the confirmed text.

getTextBounds

()method 
public function getTextBounds(startIndex:int, endIndex:int):Rectangle

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

The IME uses this method to query the bounding box of the text currently edited with the IME client. Use this method to place the candidate window and set the mouse cursor in the IME client when the mouse is over the text field or other component that supports IME.

Parameters

startIndex:int — An integer that specifies the starting location of the range of text from the bounding box you are measuring.
 
endIndex:int — Optional; an integer that specifies the ending location of the range of text from the bounding box you are measuring.

Returns
Rectangle — The bounding box of the specified range of text, or null if one or both of the indexes are invalid. This method returns the same value if startIndex is greater or less than endIndex. The same value should be returned whether or not startIndex is greater or less than endIndex.

getTextInRange

()method 
public function getTextInRange(startIndex:int, endIndex:int):String

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Gets the specified range of text from the component. This method is called during IME reconversion.

Parameters

startIndex:int — an integer that specifies the starting location of the range of text to be retrieved.
 
endIndex:int — an integer that specifies the ending location of the range of text to be retrieved.

Returns
String — The requested text, or null if no text is available in the requested range or if either or both of the indexes are invalid. The same value should be returned independant of whether startIndex is greater or less than endIndex.

selectRange

()method 
public function selectRange(anchorIndex:int, activeIndex:int):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Sets the range of selected text in the component. If either of the arguments is out of bounds the selection should not be changed.

Parameters

anchorIndex:int — The zero-based index value of the character at the anchor end of the selection
 
activeIndex:int — The zero-based index value of the character at the active end of the selection.

updateComposition

()method 
public function updateComposition(text:String, attributes:Vector.<CompositionAttributeRange>, compositionStartIndex:int, compositionEndIndex:int):void

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Callback for updating the contents of the inline editing session. This method is called whenever the text being edited with the IME has changed and its contents are used by the client to redraw the entire inline editing session.

Parameters

text:String — Contains the text of the inline edit session from the IME.
 
attributes:Vector.<CompositionAttributeRange> — Contains an array of composition clauses with adornment info.
 
compositionStartIndex:int — Start of the inline session relative to the start of the text object.
 
compositionEndIndex:int — End of the inline session relative to the start of the text object.

Event Detail

imeStartComposition

Event
Event Object Type: flash.events.IMEEvent
property IMEEvent.type = flash.events.IMEEvent.IME_START_COMPOSITION

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Dispatched when the user begins to use an IME (input method editor).

To handle IME text input, the receiver must set the imeClient field of the event to an object that implements the IIMEClient interface. If imeClient is unset, the runtime uses out-of-line IME composition instead, and sends the final composition as a TEXT_INPUT event.

This event has the following properties:

PropertyValue
bubblesfalse
cancelablefalse; there is no default behavior to cancel.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe IME object.

textInput

Event  
Event Object Type: flash.events.TextEvent
property TextEvent.type = flash.events.TextEvent.TEXT_INPUT

Language Version: ActionScript 3.0
Runtime Versions: Flash Player 10.1, AIR 2

Dispatched when the user enters text. For IME (input method editor) clients, the receiver should insert the string contained in the event object's text property at the current insertion point.

Defines the value of the type property of a textInput event object.

Note: This event is not dispatched for the Delete or Backspace keys.

This event has the following properties:

PropertyValue
bubblestrue
cancelabletrue; call the preventDefault() method to cancel default behavior.
currentTargetThe object that is actively processing the Event object with an event listener.
targetThe text field into which characters are being entered. The target is not always the object in the display list that registered the event listener. Use the currentTarget property to access the object in the display list that is currently processing the event.
textThe character or sequence of characters entered by the user.