I’m looking for a way to extend a TextField that’s allready on the stage in Flash (AS3)
something like this:
public class ChildTextField extends TextField
{
//code for childTextField comes here
}
I’ve placed a TextField with instance name ‘thetextfield’ on the stage. Now I would like to tell flash this textfield is of type ChildTextField. So in my Document Class I declare that textfield as a ChildTextField:
public class DocumentClass extends Sprite()
{
public var thetextfield : ChildTextField;
}
This throws a Type Coercion failed Error.
Is it possible to change the class that is used for a textfield in the Flash IDE like you can do with library symbols?
Afraid not. You will have to use ActionScript if you want to add your extended textfield class.
EDIT: there is a hack way. source: http://board.flashkit.com/board/archive/index.php/t-738887.html