This is the doc class that imports an instanceof a textbox from textboxes.as
Code:
package
{
//imports
import AS.textboxes
import flash.display.MovieClip;
import flash.display.Sprite;
import flash.events.Event;
import flash.events.ErrorEvent;
import flash.events.ProgressEvent;
import flash.events.MouseEvent;
import flash.net.URLLoader;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.xml.XMLDocument;
import flash.events.TimerEvent;
import flash.utils.Timer;
public class shooter extends Sprite
{
//public var playername:String="Evan"
//create an instance of the object from the textboxes class
public var playertext:textboxes;
public function shooter()
{
playertext = new textboxes(playername:String="newname")
addChild(playertext);
//playertext.text=playername;
//AS.textboxes.mytext.text=playername;
}//end constructor
}//end class
}//end package
here is textboxes.as:
Code:
package AS
{
import flash.display.*
import flash.events.*
import flash.text.*
public class textboxes extends Sprite
{
//variables
//public var myText=new TextField();
public var mytext:TextField = new TextField();
//public var playername:String="default";
public function textboxes(playername:String)
{
addChild(mytext);
mytext.x=100;
mytext.y=100;
mytext.text=playername;
}//end constructor
//place any private funtions here
}//end class
}//end package
When I create an instance of textboxes in the doc class, I am unable to change the "default" by changing the variable.
Do I have to create a superclass to extend the textboxes class in oder to make it changable?
I have been reading allot now I am trying too see how all this theory is applied and trying to determine what is efficient from what is overkill.
Thanks in advance for looking at this.
Bookmarks