I get "Packages cannot be nested" in flash CS4 when I follow this tuturial

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

When I get to the greeting world, he gives me the error "Packages cannot be nested, but when I delete {and}, he gets angry with me.

the 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 for my strange language, I have not programmed for a long time and completely forgot everything. Remember this site though!

+3
source share
3 answers

In the code where you are trying to use the Lesson1FlashCS4 class, do you use ...

include "Lesson1FlashCS4.as";

instead...

import Lesson1FlashCS4;

( - , ) - , . , .as.

+3

- , ?

, , , . , " ".

, (.. ; -)

+1

remove the void return type on your constructor. constructors cannot have return types.

public function Lesson1FlashCS4()
  {
      PBE.startup(this);
      Logger.print(this, "Hello, World!");
  }
0
source

Source: https://habr.com/ru/post/1769646/


All Articles