# Setting properties of objects found using getChildByName

**URL:** <https://forum.kirupa.com/t/setting-properties-of-objects-found-using-getchildbyname/283672>\
**Category:** flash\
**Created:** [March 9, 2009, 9:27pm UTC](https://forum.kirupa.com/t/setting-properties-of-objects-found-using-getchildbyname/283672 "2009-03-09T21:27:18Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![PatrickMichael](https://avatars.discourse-cdn.com/v4/letter/p/c6cbf5/32.png) [@PatrickMichael](https://forum.kirupa.com/u/PatrickMichael)\
**Post date:** [March 9, 2009, 9:27pm UTC](https://forum.kirupa.com/t/setting-properties-of-objects-found-using-getchildbyname/283672/1 "2009-03-09T21:27:18Z")

</div>

Hi, assistance appreciated.

I am attempting to set the propreties of a navigation button (movie clip) that has been built dynamically. The button contains a text field that I want to format and a movie clip that I want to adjust the alpha. I find the object using getChildByName(), however do not seem to be able to set the properties using the code below.

These lines throw errors:  
navObj.mainNav\_txt.setTextFormat(buttonFormat);  
navObj.smallSun\_mc.alpha = 1;

Any help appreciated

Patrick

```auto
 
private function setNavState(e:Event):void {
   if(xml) {    
    var navObj:DisplayObject = getChildByName(onNav);
    var buttonFormat:TextFormat = new TextFormat();
    buttonFormat.bold = true;
    navObj.mainNav_txt.setTextFormat(buttonFormat);
    navObj.smallSun_mc.alpha = 1;
    stage.removeEventListener(Event.ENTER_FRAME, setNavState);
   }
  }

```
