RTFM where it says all about classes.

You're taking this attitude farther than is useful. TextField is *not* simply a class like any other, it cannot be instantiated without a call to a specific constructor function that is not even in the TextField class itself. This was not a post that deserved an RTFM response, because nowhere in the manual does it explain how to extend TextField.

To the OP,

You're better off making a class that extends movie clip and creates a text field. The way I usually do it is give the class getter/setters for width, height, text, etc, and give it a draw() function. The constructor sets some default settings and calls draw, and each of the setters calls draw after setting the value. Depending on how complex you want to get, you can make getter/setters for all kinds of stuff, like label alignment, font face, bold or not, font size... basically all the parameters of a TextField. The you have an object that can be used as simply as:

var MyLabel = this.attachMovie("LabelClass","MyLabel",1,{_x:100,_y:100});
MyLabel.text = "Sample Text";

   ...or you can change all of the parameters, like tis:

var MyLabel = this.attachMovie("LabelClass","MyLabel",1,{_x:100,_y:100});
MyLabel.text = "Sample Text";
MyLabel.bold = true;
MyLabel.fontFace = "Arial";
MyLabel.size = 14;
MyLabel.setTextFormat(MyTextFormat);

The idea is that the getter/setters just pass through to the real TextField inside, but it is contained in your class so you can add new features.

ryanm
_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to