Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

1013: The private attribute may be used only on class property definitions.

New Here ,
Jan 17, 2017 Jan 17, 2017

I am a beginner with Action 3 scripting. I wrote one and am getting the above errors. I'm using Animate cc 2017. I think I know where they are, just not how to fix them. Below is the script. Thank you for looking.

package com.josephlabrecque {

  

    import flash.display.MovieClip;

    import flash.text.TextField;

    import flash.display.SimpleButton;

    import flash.events.Event;

    import com.josephlabrecque.QuestionBank;

    import flash.events.MouseEvent;

    import flash.utils.setTimeout;

  

  

    public class QuizGame extends MovieClip {

      

        public var trueBtn:SimpleButton;

        public var falseBtn:SimpleButton;

        public var questionText:TextField;

        public var statusMsg:TextField;

      

        private var questionBank:QuestionBank;

        private var questionArray:Array;

      

        private const questionMax:int = 5;

        private var questionCount:int = 0;

        private var currentAnswer:String;

      

      

        private var currentScore:int = 0;

      

        public function QuizGame() {

            statusMsg.text = "";

            questionArray = new Array();

            questionBank = new QuestionBank();

            questionBank.addEventListener(Event.COMPLETE, dataReady);

            trueBtn.addEventListener(MouseEvent.CLICK, truePressed);

            falseBtn.addEventListener(MouseEvent.CLICK, falsePressed);

}

        }

    private function dataReady(e:Event):void {

        questionArray = questionBank.buildBank();

        grabQuestion();

}

private function grabQuestion():void {

  if(questionCount < questionMax){

    var max:int = questionArray.length-1;

    var rq:int = Math.floor(Math.random() * (max - 0 + 1));

    var ta:Array = questionArray.splice(rq, 1);

    questionText.text = ta[0].q;

    currentAnswer = ta[0].tf;

    questionCount++;

} else{

    gameOver();

  }

}

    private function gameOver():void {

  statusMsg.text = currentScore+"/100 points";

  questionText.text = "Game Over!";

}

    private function truePressed(e:MouseEvent):void {

    if(statusMsg.text == ""){

    if(currentAnswer == "true"){

      currentScore += 100/questionMax;

      statusMsg.text = "CORRECT!";

    }else{

      statusMsg.text = "WRONG";

    }

    setTimeout(newQuestion, 1000);

  }

}

        private function falsePressed(e:MouseEvent):void {

  if(statusMsg.text == ""){

    if(currentAnswer == "false"){

      currentScore += 100/questionMax;

      statusMsg.text = "CORRECT!";

    }else{

      statusMsg.text = "WRONG";

    }

    setTimeout(newQuestion, 1000);

  }

}

        private function newQuestion():void {

        statusMsg.text = "";

        grabQuestion();

}

    }

  

}

errors are:

C:\Users\cynth\Desktop\Excersizes\com\josephlabrecque\QuizGame.as, Line 39, Column 3    1013: The private attribute may be used only on class property definitions.

C:\Users\cynth\Desktop\Excersizes\com\josephlabrecque\QuizGame.as, Line 43, Column 1    1013: The private attribute may be used only on class property definitions.

C:\Users\cynth\Desktop\Excersizes\com\josephlabrecque\QuizGame.as, Line 56, Column 2    1013: The private attribute may be used only on class property definitions.

C:\Users\cynth\Desktop\Excersizes\com\josephlabrecque\QuizGame.as, Line 60, Column 2    1013: The private attribute may be used only on class property definitions.

C:\Users\cynth\Desktop\Excersizes\com\josephlabrecque\QuizGame.as, Line 71, Column 3    1013: The private attribute may be used only on class property definitions.

C:\Users\cynth\Desktop\Excersizes\com\josephlabrecque\QuizGame.as, Line 82, Column 3    1013: The private attribute may be used only on class property definitions.

TOPICS
ActionScript
305
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jan 18, 2017 Jan 18, 2017

The problem might be the second curly bracket you have after your public QuizGame function.  Unless my eyes are deceiving me it is closing the class definition prematurely.

Translate
LEGEND ,
Jan 18, 2017 Jan 18, 2017

The problem might be the second curly bracket you have after your public QuizGame function.  Unless my eyes are deceiving me it is closing the class definition prematurely.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 18, 2017 Jan 18, 2017
LATEST

that seemed to open the function but did not solve the attribute errors

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines