PDA

View Full Version : package import not working



rahul_7star
December 10th, 2007, 11:20 PM
Hi i had created 1 folder and name it "S" and inside 1 fla is there and code goes like this

package s {
import flash.display.Sprite;
import flash.text.TextField;
public class Suplemental_1 extends Sprite
{
private var tField:TextField;
public function Suplemental_1 ()
}
public function thisTest ():void
{
tField = new TextField();
tField.autoSize = "left";
tField.background = true;
tField.border = true;
tField.x = 200;
tField.y = 200;
tField.text = "Hello You, what is your name?";
addChild(tField);
}
}




but m getting 1 erorr as package cant b nested , i dont knw d reason ,
i want to execute the code , so plz help and do i req to do cretian change in path

onecommoncode
December 11th, 2007, 12:06 AM
Looks like you did not end some of your methods correctly. Try the below



package s
{
import flash.display.Sprite;
import flash.text.TextField;

public class Suplemental_1 extends Sprite
{
private var tField:TextField;

public function Suplemental_1 ():void
{
}

public function thisTest ():void
{
tField = new TextField();
tField.autoSize = "left";
tField.background = true;
tField.border = true;
tField.x = 200;
tField.y = 200;
tField.text = "Hello You, what is your name?";
addChild(tField);
}
}
}