findPreviousWordBoundary and enter key
these code work great
and it get the last word
but when i use enter key
it's go wrong
and stop getteng last word
remark:some vaiable it for my program
when i comment the findPreviousWordBoundary line
it get all text
<fx:Script>
<![CDATA[
import flashx.textLayout.elements.ParagraphElement;
protected function togglebutton1_clickHandler(event:MouseEvent):void
{
var urlLoader:URLLoader = new URLLoader();
var suggestions:Array = new Array();
var suggested:Array = new Array();
var textfields:Array = new Array();
var format:TextFormat = new TextFormat();
var currentSelection:int = -1;
mytextflow.addEventListener(KeyboardEvent.KEY_UP, suggest);
function suggest(event:KeyboardEvent):void
{
suggested = [];
var activePos:int = mytextflow.selectionActivePosition
var curParagraph:ParagraphElement = mytextflow.textFlow.findLeaf(activePos).getParagraph();
var wordBoundary:int = curParagraph.findPreviousWordBoundary(activePos);
// var lastword:String = curParagraph.getText(wordBoundary,activePos);
}
}
]]>
</fx:Script>
<s:ToggleButton x="21" y="10" click="togglebutton1_clickHandler(event)"/>
<s:RichEditableText id="mytextflow" x="111" y="43" width="363" height="285" backgroundColor="#C39191"/>
</s:Application>
