What I would like to do is to call a method from a superclass in a subclass. Specifically I want to be able to add the subclass as a child of the superclass but without physically having to type addChild in the superclass (but I will have to type it in the subclass). For now I'm just trying to call a method in the superclass that draws some text from a subclass.
Here is the MAIN class (the superclass)
package
{
import flash.display.*;
import flash.events.*;
import flash.text.*;
public class MAIN extends Sprite
{
public var SOMETEXT:TextField = new TextField();
public function MAIN()
{
new OBJECT_square().CREATE();
}
public function DRAWTEXT():void
{
SOMETEXT.text = "sometext";
addChild(SOMETEXT);
}
}
}
Here is the OBJECT_square class (the subclass)
package
{
import flash.display.*;
import flash.events.*;
public class OBJECT_square extends MAIN
{
public function CREATE():void
{
MAIN.DRAWTEXT();
}
}
}
The code doesn't compile, I get "Call to a possibly undefined method DRAWTEXT through a reference with a static type class".
I realize there are otherways to display text on the screen. I just need to learn how to call superclass methods.