I’m trying to create a simple “smart” textbox component in Flex, and I want a function inside it that I can use outside of the component to force itself to select all text inside of it.
Inside my SmartTextbox.mxml:
public function selectAll():void
{
this.setSelection(0, this.length);
}
I also use this function when the textbox gets focus, like this:
private function onTextInput_focusIn(event:Event):void
{
selectAll();
}
The later one, on focusIn event, is working.
But if I try to call the function from outside, like:
Inside another component where texInputQuickSearch is a SmartTextBox-component.
if(searchModule.currentState == SearchModule.STATE_SEARCH)
{
doSearch();
searchModule.textInputQuickSearch.selectAll();
}
It won’t reselect the text.
Why does it work like this?
You need to do something similar to this…
AS3:
}
MXML: