Using a TextField in a class extending mx.core.View

Since createChild(className:Object, instanceName:String) abstracts the creation of the actual object, TextField’s are hard. They aren’t supported as the first parameter, and doing a createTextField messes up your styles, but createLabel uses it’s own depth.

There IS a depth variable, however, you must take care to access it in the right order. The best way is:

createLabel("my_txt", depth++);

If you do a ++depth, it’ll increment too soon, whilst the rest do a depth++ and overrwrite the depth of one of your controls, destroying it.