I keep getting, this error"Error package cannot be nested", when I compile my code:
package {
import flash.display.Sprite;
import flash.text.TextField;
public class MessageBox extends Sprite {
function MessageBox():void {
var msgbox:Sprite = new Sprite();
// drawing a white rectangle
msgbox.graphics.beginFill(0xFFFFFF); // white
msgbox.graphics.drawRect(0,0,300,20); // x, y, width, height
msgbox.graphics.endFill();
// drawing a black border
msgbox.graphics.lineStyle(2, 0x000000, 100); // line thickness, line color (black), line alpha or opacity
msgbox.graphics.drawRect(0,0,300,20); // x, y, width, height
var textfield:TextField = new TextField()
textfield.text = "Hi there!"
addChild(msgbox)
addChild(textfield)
}
}
}
What is a nested package, and how do I fix it?
FlashDave
FlashDave 0 Newbie Poster

rajarajan2017
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.