for example i have object one a Textinput haveing id=”
id_txtBox
“, and a panel having a lot of children(TextInputs, Trees, Buttons etc.)..
if user is editing text in one of panel’s child and then clik on “id_txtBox”. can we get to know
the id/object user were editing before
the click on “id_txtBox
“. i mean from which object the “id_txtBox” has stolen focus..?
Add an event listener to each child that will update a currentChild property by getting the name of the clicked element.
var previousChild:DisplayObject; var currentChild:DisplayObject; panelChild.addEventListener(MouseEvent.CLICK , clickHandler ); private function clickHandler(event:MouseEvent):void { //to avoid an error on the first click if(currentChild != null ) previousChild = currentChild; // do whatever you need to do here, after it's complete, update the currentChild value; // this way the previousChild value indicates the object that was clicked before currentChild = this.getChildByName(event.currentTarget.name ); }