|
-
Lost focus in RichText Editor
Hello everyone,
I am trying to capture the focusOut event on the RichText Editor when I click on another part of the stage or another button. My problem is when I click on the Bold button or any other button on the RichText Editor it returns an focusOut event.
I would only like to have this event fire when I click something else other than the RichText Editor.
Any suggestions.
Code:
function fout(e:FocusEvent):void{
trace('out');
}
texteditor1.addEventListener('focusOut', fout);
I could have created a enterFrame event but I did not want to have a function checking the stage.focus.
When adding a class to a movie is there a way to isolate the class so that it only returns the events that are added to the main movie?
-
KoolMoves Moderator
Look into some of the focus events, there should be a way to do this. You may have to on focus out to then check that the object that is the reciever object and only respond if it's NOT on of the RT buttons.
-
Reason:
Trying to create a simple popup editor. If the user selects something else on the stage I want the editor to disappear and text saved. If the editor is part of class that I create. I would have thought when I load the class in a variable and set any event to that variable then the event would act as a global to the entire class.
-
An easy solution might be to add a listener to the stage for the mouseDown event and perform a hitTest to see if it was clicked outside of the RTE.
Code:
function mdown(e:MouseEvent):void {
if (!texteditor1.hitTestPoint(e.stageX, e.stageY)){
trace ('clicked outside');
}
}
stage.addEventListener('mouseDown', mdown);
If you want a popup, you can also consider using a DragContainer. Assuming you have a RTE on stage named texteditor1
Code:
var dc:DragContainer = new DragContainer();
ScriptedSkin.applyTo(dc);
addChild(dc);
dc.showClose = true;
dc.header.label.text = 'Rich Text Editor';
dc.object = texteditor1;
dc.move(20,20);
Last edited by w.brants; 04-30-2009 at 02:14 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|