This content has been marked as final. Show 4 replies
>>In flash file i created the instance
>>var tf:TextField_alwaysShowSelection = new TextField_alwaysShowSelection();
The code you posted is to be set as the document class. There are two ways to do this:
-in the fla in the Property Inspector -> option 'Document Class' -> TextField_alwaysShowSelection
-in the fla File -> Publish Settings -> tab Flash -> ActionScript 3.0 option Settings -> Document Class -> TextField_alwaysShowSelection
Thanks for the reply..
I will try it..
Also is this mentioned somewhere..in the docs/help??
Yes, that's mentioned in the doc's.
The thing with your posted code is that when you set the Document class you are in fact extending the _root (which wasn't possible in AS2) and consequently the code 'knows' what you mean with addChild() - add the TextField to the display list of the _root.
If you want to create an instance of the TextField_alwaysShowSelection class on the timeline you (like in AS2) have to provide a target movieclip (or rather 'display object') where the TextField has to be displayed.
var tf:TextField_alwaysShowSelection = new TextField_alwaysShowSelection(this);
and the class as attached. But, you should always init an app with a Document Class.
Thanks for the explanation.