# Up for a challenge? Styling Components w AS

**URL:** <https://forum.kirupa.com/t/up-for-a-challenge-styling-components-w-as/250759>\
**Category:** Uncategorized\
**Created:** [February 1, 2008, 4:59am UTC](https://forum.kirupa.com/t/up-for-a-challenge-styling-components-w-as/250759 "2008-02-01T04:59:25Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![asiabackpacker](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/asiabackpacker/32/3133_2.png) [@asiabackpacker](https://forum.kirupa.com/u/asiabackpacker)\
**Post date:** [February 1, 2008, 4:59am UTC](https://forum.kirupa.com/t/up-for-a-challenge-styling-components-w-as/250759/1 "2008-02-01T04:59:25Z")

</div>

OK, here’s the code I’m using:

var oListener:Object = new Object();  
oListener.onSetFocus = function(oldFocus, newFocus) {

trace("oldFocus: " + oldFocus);  
trace(“newFocus: " + newFocus);  
trace(“Selection.getFocus(): " + Selection.getFocus());  
trace(””);

};

Selection.addListener(oListener);

Clicking on any input field in my form triggers the function, as it should. The challenge is, I want to get the name of the field. What the function returns for newFocus is:

\_level0.subject\_txt.label

But I can’t target it correctly with “label” on there:

What I want to do is target the setStyle property, like this:

\_level0.name\_txt.setStyle(“backgroundColor”, “0x000000”);

Does anyone have any idea how to do this?

Thanks,  
Elliott
