May 3, 2009 at 13:45[AS3] Using stage.focus

All InteractiveObject based object can be focused :

displayobject_subclasses

You don’t need the fl.managers.FocusManager to set or remove the focus on objects :

// to set the focus
stage.focus = myTextField;

// to remove the focus
stage.focus = null;

If the focused InteractiveObject is hided, it loose the focus :

stage.focus = myTextField;

trace(stage.focus); // output : [object TextField]

myTextField.visible = false;

trace(stage.focus); // output : null

To remove the crappy yellow rect on all focused InteractiveObject :

stage.stageFocusRect = null;
Written by Rémi.T under Coding.
Tags: , .
2 comments »

2 Comments

  1. Comment by Kawika on September 1, 2010 @ 01:58

    Perfect! I wanted to hide the crappy yellow rectangle, and now I know how!! Thanks!

  2. Comment by Bartj3 on August 2, 2011 @ 12:36

    came here googling for stageFocusRect, thanks for the tip!

    Flash expects a Boolean though, so fixed it using stage.stageFocusRect = false;

Leave a comment