How do I remove the yellow border when an object has focus in Flash?

12.8k Views Asked by At

How do i remove the yellow border - focusRect - in as3 I've tried Stage.focusRect = false but that doesn't do the job.

3

There are 3 best solutions below

0
On

Try:

focusRect = false;

In your class' constructor. Worked for me :-)

From the docs: flash.display.InteractiveObject.focusRect(focusRect:Object):void

Specifies whether this object displays a focus rectangle. It can take one of three values: true, false, or null. Values of true and false work as expected, specifying whether or not the focus rectangle appears. A value of null indicates that this object obeys the stageFocusRect property of the Stage.

0
On

I faced the same problem while I was making a Game. I wanted focus on my main class by typing:

stage.focus = this;

but a yellow rectangle appeared.

Then I typed:

stage.focus = this;
this.focusRect = false;

but this time, not a yellow rectangle but a yellow line appeared.

Then I typed:

this.focusRect = false;
stage.focus = this;

And this time it worked. No yellow rectangle or line appeared. So, I realized that order does matter sometimes.

If you're working with class just import:

import flash.display.Stage;
1
On
stage.stageFocusRect = false;

More info: Rockabit blogpost

:)