# Tab-key/FocusRect Disabling - Help!

**URL:** <https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827>\
**Category:** flash\
**Created:** [August 7, 2003, 12:01am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827 "2003-08-07T00:01:40Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![REEF](https://avatars.discourse-cdn.com/v4/letter/r/ce73a5/32.png) [@REEF](https://forum.kirupa.com/u/REEF)\
**Post date:** [August 7, 2003, 12:01am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/1 "2003-08-07T00:01:40Z")

</div>

I forgot the actionscript but what I wanted to do is disable the yellow focus rectangle that comes up on a button when the tab key is pressed. Now, thats easy:

[AS]buttonname.\_focusrect = false[/AS]

Ok but how do I disable it for everysingle button in the whole movie? And where do I put this actionscript? In the first keyframe?

I think the action script may have to do with proto or prototype, I don’t wanna ask people on Newgrounds how to do it. Thanx.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:20am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/2 "2003-08-07T00:20:43Z")

</div>

yea thats the right syntax, you can put it on a blank keyframe, or where there is already code. i think you can put all ur buttons in a an array and just say

myArray.\_focusrect = false

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:21am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/3 "2003-08-07T00:21:00Z")

</div>

[AS]for (name in \_root) {  
if (typeof (\_root[name]) == “object”) {  
\_root[name].\_focusrect = false;  
}  
}[/AS]i think this will disable focus on all button + textfields + objects in \_root  
:-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:22am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/4 "2003-08-07T00:22:46Z")

</div>

Wait claudio…what do I put in for [name] ??? Its for the whole movie, not a button or movie clip.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:23am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/5 "2003-08-07T00:23:23Z")

</div>

Just paste that code on first frame of your main timeline

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:26am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/6 "2003-08-07T00:26:59Z")

</div>

Tried it…doesnt work. The rect still appears.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:28am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/7 "2003-08-07T00:28:34Z")

</div>

As i said, that will only disable focus if the objects are in \_root.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:29am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/8 "2003-08-07T00:29:18Z")

</div>

isnt there an easier way? i know theres a code for it, its like 1 line long and it works.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:39am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/9 "2003-08-07T00:39:32Z")

</div>

[AS]Button.prototype.tabEnabled = false;[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:44am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/10 "2003-08-07T00:44:26Z")

</div>

Kax, that will exclude the button in automatic tab ordering.  
He wants to disable the yellow focus rectangle.  
:-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:49am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/11 "2003-08-07T00:49:25Z")

</div>

… Do you really think I don’t know that!? 😛

The thing is,  
[AS]Button.prototype.\_focusrect = false;[/AS]  
doesn’t work. :-\

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:53am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/12 "2003-08-07T00:53:48Z")

</div>

[AS]MovieClip.prototype.allowFocus = function(act) {  
for (var counter in this) {  
if (this[counter]. **proto** == Button.prototype) {  
this[counter].\_focusrect = act;  
} else if (this[counter]. **proto** == MovieClip.prototype && this[counter].\_parent == this) {  
this[counter].allowFocus(act);  
}  
}  
};  
ASSetPropFlags(MovieClip.prototype, “allowFocus”, 7);  
allowFocus(false);[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:57am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/13 "2003-08-07T00:57:11Z")

</div>

😛

I was about to post this:  
[AS]MovieClip.prototype.enableFocusRect = function() {  
for (var prop in this) {  
if (this[prop] instanceof MovieClip) {  
this[prop].enableFocusRect(arguments[0]);  
} else if (this[prop] instanceof Button) {  
this[prop].\_focusrect = arguments[0];  
}  
}  
};  
// example  
\_level0.enableFocusRect(false);[/AS]

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 12:59am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/14 "2003-08-07T00:59:12Z")

</div>

Hey cladio - what do u mean thatll exclude the button in automatic tab ordering?

Hey kax…thanks a lot. The button.prototype.tabenable=false thingy works perfectly now. But you’re sure it works for everysingle button right? What about for buttons inside symbols, and buttons in other scenes?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 1:00am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/15 "2003-08-07T01:00:33Z")

</div>

Yes, the property will be disabled in every single Button object.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 1:02am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/16 "2003-08-07T01:02:46Z")

</div>

Thanks. BTW, whats all that other A.S. about?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [August 7, 2003, 1:15am UTC](https://forum.kirupa.com/t/tab-key-focusrect-disabling-help/27827/17 "2003-08-07T01:15:31Z")

</div>

There’s not much I can tell about it.

It’s a method that will loop through all the objects. If the object is a MovieClip, it will call the method; if the object is a Button, it will set to false (or true, depending on the parameter passed to the function (kind of obvious, isn’t it?)) its \_focusrect property.

Pretty simple. 😉
