# Text changes size depending on the parent height

**URL:** <https://forum.kirupa.com/t/text-changes-size-depending-on-the-parent-height/326074>\
**Category:** flash\
**Created:** [November 21, 2011, 4:07pm UTC](https://forum.kirupa.com/t/text-changes-size-depending-on-the-parent-height/326074 "2011-11-21T16:07:33Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![avh](https://avatars.discourse-cdn.com/v4/letter/a/cdc98d/32.png) [@avh](https://forum.kirupa.com/u/avh)\
**Post date:** [November 21, 2011, 4:07pm UTC](https://forum.kirupa.com/t/text-changes-size-depending-on-the-parent-height/326074/1 "2011-11-21T16:07:33Z")

</div>

I am attempting to create some sort of information sheet that contains some rows of texts, dynamically loaded from an xml file. I don’t have much experience with Action Script, but I’ve been programming in various languages for many years.

```auto

var properties = myXML.firstChild.childNodes;                
var propFormat:TextFormat = new TextFormat();
var valueFormat:TextFormat = new TextFormat();
propFormat.bold = true;                    
propFormat.size = 10;
valueFormat.size = 10;
valueFormat.color = 0x0000ff;
valueFormat.italic = true;
    
_root.myInfo_mc._height = properties.length * 15;
for(var i = 0; i < properties.length; i++){
    var propTxt:TextField = _root.myInfo_mc.createTextField("prop" + i, i*2, 2, i*15, 200, 13);
    var valueTxt:TextField = _root.myInfo_mc.createTextField("value" + i, i*2 + 1, 85, i*15, 200, 13);                                                                                                    
    propTxt.text = properties*.attributes.name + ": ";        
    valueTxt.text = properties*.attributes.value;        
    propTxt.autoSize = false;
    valueTxt.autoSize = false;
    propTxt.setTextFormat(propFormat);
    valueTxt.setTextFormat(valueFormat);    
}

```

The code is straightforward, i have one box called myInfo\_mc, which is the parent.  
I change its height depending on how many lines the xml file has and then I iterate through the xml properties, creating texts that I position vertically.  
I am at a point where it drives me insane, because the longer the xml is, the bigger the text becomes.

If I do **\_root.createTextField(“prop” + i, i_2, 2, i_15, 200, 13)** the texts will have the specified size, but I do not want a ton of texts just floating around, as it would complicate hiding/moving around the information.  
Any hint would be appreciated.
