• 0
Sign in to follow this  
tassiocaique

Problema na definição de classes

Question

Olá pessoal, tudo bem ?

Bem, estou com um problema na definição de uma classe. O compilador apresenta os seguintes erros:

...\Welcome.as(23): col: 4 Error: The private attribute may be used only on class property definitions.

...\Welcome.as(30): col: 4 Error: The public attribute can only be used inside a package.

...\Welcome.as(57): col: 4 Error: The public attribute can only be used inside a package.

O código de definição segue abaixo:

package screens 
{
    import starling.display.Button;
    import starling.display.Image;
    import starling.display.Sprite;
    import starling.events.Event;
    
    public class Welcome extends Sprite 
    {
        private var bg:Image;
        private var title:Image;
        private var hero:Image;
        
        private var playBtn:Button;
        private var aboutBtn:Button;
        
        
        public function Welcome() 
        {
            //super();
            this.addEventListener(starling.events.Event.ADDED_TO_STAGE, onAddedToStage);
            
            private function onAddedToStage(event:Event):void 
            {
                trace ("WelcomeScreen to initialized");
                
                drawScreen();
            }
            
            public function drawScreen():void
            {
                bg = new Image(Assets.getTexture("BgWelcome"));
                this.addChild(bg);
                
                title = new Image(Assets.getTexture("WelcomeTitle"));
                title.x = 440;
                title.y = 20;
                this.addChild(title);
                
                hero = new Image(Assets.getTexture("WelcomeHero"));
                this.addChild(hero);
                hero.x = -hero.width;
                hero.y = 100;
                
                playBtn  = new Button(Assets.getTexture("WelcomePlayBtn"));
                this.addChild(playBtn);
                playBtn.x = 500;
                playBtn.y = 260;
                
                aboutBtn = new Button(Assets.getTexture("WelcomeAboutBtn"));
                this.addChild(aboutBtn);
                aboutBtn.x = 410;
                aboutBtn.y = 380;
                                
            }
            
            public function initialize():void        
            {
                this.visible = true;                
                hero.x = -hero.width;
                hero.y = 100;
            }
        }
    }
}

Eu uso a última versão do FlashDevelop, AIR 3.2 e Flash Debug Player 11.2 ...

Qual pode ser o problema?

Desde já, obrigado

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this