I am new to AS3. When learning AS3, I get the below code from adobe example and try to run it giving a error like
"1037: Packages cannot be nested."
What is this mean?
Please tell me how to execute? or any problem in this code?
package {
import flash.display.Sprite;
import flash.text.TextField;
import flash.text.TextFieldType;
public class TextField_alwaysShowSelection extends Sprite {
public function TextField_alwaysShowSelection() {
var label1:TextField = createTextField(0, 20, 200, 20);
label1.text = "This text is selected.";
label1.setSelection(0, 9);
label1.alwaysShowSelection = true;
var label2:TextField = createTextField(0, 50, 200, 20);
label2.text = "Drag to select some of this text.";
}
private function createTextField(x:Number, y:Number, width:Number, height:Number):TextField {
var result:TextField = new TextField();
result.x = x; result.y = y;
result.width = width; result.height = height;
addChild(result);
return result;
}
}
}