views:

30

answers:

2

Tutorial: http://pushbuttonengine.com/docs/Lesson-01-FlashCS4.html

When I get to hello world, It gives me the error "Packages cannot be nested but, when I remove the { and } it gets mad at me.

Code:

package
{
    import flash.display.Sprite;
    import com.pblabs.engine.PBE;
    import com.pblabs.engine.debug.Logger;

    public class Lesson1FlashCS4 extends Sprite
    {
        public function Lesson1FlashCS4():void
        {
            PBE.startup(this);
            Logger.print(this, "Hello, World!");
        }
    }
}

Sorry about my strange language, I have not programmed in a long time and have forgotten most everything. Did remember this site though!

A: 

The code on the site looks perfectly valid -- are you sure you've typed it out verbatim?

The only other thing that I can think of that could be causing the problem is if you put the code on the frame instead of the document class. Make double sure you've followed the instructions in the "Document Class" section precisely.

If you posted more details we could answer more easily (i.e. without guessing ;-)

Cameron
OK, I put did their instructions for frame. That should solve the problem.
A: 

remove the void return type on your constructor. constructors can't have return types.

public function Lesson1FlashCS4()
  {
      PBE.startup(this);
      Logger.print(this, "Hello, World!");
  }
TheDarkInI1978
Actually, constructors in AS3 are allowed to have a return type, as long as it's `void`.
Cameron
ah, i stand corrected. however, it's rare to see void on a constructor since it's completely uncommon.
TheDarkInI1978