Hey guys,
This is my first post on Kirupa.
Basically the issue I am having is related to the TextField class. I was hoping to create a custom textField class which would allow me to specify the x and y positions of the textField upon creating it.
However in trying I received numerous errors. Below is my code.
AS file
package
{
import flash.text.TextField;
public class TextBox extends TextField
{
//variables
var textBox:TextField = new TextField();
var xPosition:Number;
var yPosition:Number;
public function TextBox(xPos:Number, yPos:Number)
{
textBox.xPosition = xPos;
textBox.yPosition = yPos;
}
public function setXPosition(xPos:Number):void
{
textBox.xPosition = xPos;
}
}
}
FLA file
var tb:TextBox = new TextBox(30, 30);
When I run I get this error…
1119: Access of possibly undefined property xPosition through a reference with static type flash.text:TextField.
I would appriciate any help on the matter, Im new to the whole concept of OOP.
Regards,
jack