TextField won't display if parent is a child?
Hi!
I'm writing a new framework but I've encountered an odd bug. Whenever I add a class as a child to my main sprite, it doesn't display the class's TextField. Only if I add it as a child of the stage will it display.
Main.as (Highlighted as Java)
spirea = new World(this.stage);
spirea.addChild(new LoginForm(spirea));
LoginForm.as
public class LoginForm extends Sprite
{
public var usernameField:TextField;
public var passwordField:TextField;
public function LoginForm(w:World)
{
usernameField = new TextField;
usernameField.x = 200;
usernameField.y = 50;
usernameField.width = 200;
usernameField.height = 35;
usernameField.border = true;
usernameField.borderColor = 0x000000;
usernameField.type = TextFieldType.INPUT;
addChild(usernameField);
}
}
World is an extention of Sprite with a shaded bitmap added to it for decoration. It's a constant throughout the game, as in it doesn't disappear. The present code doesn't work. If I don't make it a child of spirea, it will work just fine. However, if I do w.addChild(usernameField); in LoginForm.as, it doesn't work. Neither does a combination of spirea.addChild(new LoginForm(spirea)); in Main.as and w.addChild(usernameField);
Is this just the nature of TextField or am I doing something very wrong?
