I created a document class for an empty stage and would like to create an output class which is imported into the document class.
Inside the output class I would like to create a textField with the methods to set and read the text.
a) empty stage with document class “tommy”
b) document class “tommy”
package {
import flash.display.MovieClip;
import cOutput;
public class tommy extends MovieClip {
var _loc_1:cOutput;
public function tommy() {
_loc_6 = new cOutput;
_loc_6.setOutput();//("hurra");
}
}
}
c) output class cOutput (with or without extends Movieclip)
package {
//import flash.display.MovieClip;
import fl.controls.TextInput;
public class cOutput{ //extends MovieClip {
public var texteField:TextInput;
public function cOutput() {
texteField = new TextInput();
addChild(texteField);
texteField.text = "Seriously... I need to be displayed."
}
public function setOutput(printValue:String){
texteField.text = printValue;
}
}
}
I am receiving “Definition fl.controls:TextInput could not be found”.
I read that you need to have this in the library (I dragged a text field as classic text, input text on stage).
Seems I am not getting this working.
Any idea what I am doing wrong?
Use the
TextFieldclass instead of theTextInputclass. TheTextFieldclass is the most basic text component: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/text/TextField.htmlOn a side note, your
addChild()call won’t do anything, ascOutputisn’t a display object.