0
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
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by rajarajan07
0

Its working! Just create a (MessageBox.as) file with the name of your class and paste your code there. Open your flash file and give your class name within the Document. Ctrl+Enter to run the file. Thats it! I checked it.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.