# When I change the width of a parent sprite, the child TextField wont display

**URL:** <https://forum.kirupa.com/t/when-i-change-the-width-of-a-parent-sprite-the-child-textfield-wont-display/273191>\
**Category:** Uncategorized\
**Created:** [October 12, 2008, 9:11pm UTC](https://forum.kirupa.com/t/when-i-change-the-width-of-a-parent-sprite-the-child-textfield-wont-display/273191 "2008-10-12T21:11:04Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![min\_emerg](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@min\_emerg](https://forum.kirupa.com/u/min_emerg)\
**Post date:** [October 12, 2008, 9:11pm UTC](https://forum.kirupa.com/t/when-i-change-the-width-of-a-parent-sprite-the-child-textfield-wont-display/273191/1 "2008-10-12T21:11:04Z")

</div>

Hey,  
Ive got a problem that is driving me insane. I have a parent class which extends sprite, and within it I create a TextField object and add this as a child to the parent. The TextField object displays correctly if I dont change the parents width using this.width. As soon as I assign a value to the parents width, the text will not render. Any ideas?

-------- Code ---------

package  
{  
import flash.display._;  
import flash.text._;

public class main extends MovieClip  
{  
public function main()  
{  
var p:Parent = new Parent();  
addChild§;  
p.createchild();  
}  
}  
}

* * *

package  
{  
import flash.display._;  
import flash.text._;

public class Parent extends Sprite  
{  
public function Parent()  
{  
this.width = 300; // PROBLEM POINT!!  
}

public function createchild()  
{  
var GC:TextField = new TextField();  
GC.x = 10;  
GC.y = 10;  
GC.text = “text”;  
GC.width = 50;  
GC.height = 20;

this.addChild(GC);

}  
}  
}

* * *

Thanks for any help.  
Cheers.
