Skip to main content
Participant
May 10, 2013
Answered

Where is my error????

  • May 10, 2013
  • 1 reply
  • 525 views

its saying that the private attribute may be used only on a class property definitions

the public attirbute can only be used inside a package

package states

{

          import flash.media.Sound;

          import starling.display.Button;

          import starling.display.Image;

          import starling.display.MovieClip;

          import starling.display.Sprite;

          import starling.textures.Texture;

          import starling.events.Event;

          import starling.text.TextField;

          import starling.textures.TextureAtlas;

          import starling.utils.Color;

          import states.IgameState;

 

          /**

           * ...

           * @7111211 Stefan Oprisan

           */

 

           //function to the starling stage object(comes from the main stagestarling class)

          public class menu_Splash extends Sprite implements IgameState

          {

                    //this holds our display objects such as BG's, sprites, etc.

          private var gameClassRef:game;

          private var background:Image;

          private var GameName:TextField;

          private var GameName2:TextField;

          private var PressEnter:TextField;

          private var JumpToMainMenu:Button;

          private var waterfall:MovieClip;

          private var vector:Vector.<MovieClip>;

          private var changeState:IgameState;

 

                    public function menu_Splash(extGameClassRef:game)

                    {

                              this.gameClassRef = extGameClassRef; //use the above reference

                              this.addEventListener(Event.ADDED_TO_STAGE, init);

                    }

 

                    private function init(e:Event):void

                    {

                              removeEventListener(Event.ADDED_TO_STAGE, init);

 

                              background =  new Image(embeded_Assets.myTexAtlas.getTexture("initial menu"));

                              this.addChild(background);

 

                              JumpToMainMenu = new Button(embeded_Assets.myTexAtlas.getTexture("BG_invisible"), "");

                              JumpToMainMenu.addEventListener(Event.TRIGGERED, onActivate);

                              this.addChild(JumpToMainMenu);

 

                              JumpToMainMenu.addEventListener(Event.TRIGGERED, onActivate);

                              JumpToMainMenu.x = 507; //X position

                              JumpToMainMenu.y = 250;          //Y position

                              JumpToMainMenu.text = "Press Enter to Begin"; //type here what text you want to say

                              JumpToMainMenu.fontName = "Capture it"; //font name

                              JumpToMainMenu.fontSize = 10; //change here the size of the font

                              JumpToMainMenu.fontColor = Color.WHITE;          //color of the text

                              this.addChild(JumpToMainMenu);

 

                              GameName = new TextField(400, 200, ""); //here you can change the position and what it can say

                              GameName.x = -20; //X position

                              GameName.y = 130; //Y position

                              GameName.text = "Trigger"; //type here what text you want to say

                              GameName.fontName = "Capture it"; //font name

                              GameName.fontSize = 70; //change here the size of the font

                              GameName.color = Color.WHITE; //color of the text

                              GameName.width = 500; //this extends the boundary of how big it can be

                              GameName.height = 200; //this extends the boundary of how big it can be

                              GameName.alpha = 0.85; //this changes the tranparency

                              this.addChild(GameName);

 

                              GameName2 = new TextField(400, 200, ""); //here you can change the position and what it can say

                              GameName2.x = -17; //X position

                              GameName2.y = 190; //Y position

                              GameName2.text = "Happy"; //type here what text you want to say

                              GameName2.fontName = "Capture it"; //font name

                              GameName2.fontSize = 90; //change here the size of the font

                              GameName2.color = Color.WHITE; //color of the text

                              GameName2.width = 500; //this extends the boundary of how big it can be

                              GameName2.height = 200; //this extends the boundary of how big it can be

                              GameName2.alpha = 0.85; //this changes the tranparency

                              this.addChild(GameName2);

 

                              embeded_Assets.theme.play(); //here the theme song starts playing in a loop

 

                    /*public function water()

                    {

 

                              waterfall(embeded_Assets.myTexAtlas2("001"), 12);

                              pivotX = width * 0.5;

                              pivotY = height * 0.5;

 

                    }*/

                    private function onActivate(e:Event):void

                    {

                              this.gameClassRef.changeState(game.MENU_MAIN);

                    }

 

 

                    //Interface IgameState

                    public function update():void

                    {

                              if (game.myGameInput.pressing.up == true)

                              {

                                        trace ("Up Press");

                                        //trace ("");

                              }

 

                              if (game.myGameInput.pressing.down == true)

                              {

                                        trace ("Down Press");

                                        //trace ("");

                              }

 

                              if (game.myGameInput.pressing.enter == true)

                              {

                                        this.gameClassRef.changeState(game.MENU_MAIN)

 

                              }

 

 

                    public function destroy():void

                    {

                              background.removeFromParent(true);

                              background = null;

 

                              GameName.removeFromParent(true);

                              GameName = null;

 

                              JumpToMainMenu.removeFromParent(true);

                              JumpToMainMenu = null;

 

                              this.removeFromParent(true);

                    }

 

                    }

                    }

          }

}

This topic has been closed for replies.
Correct answer kglad

that usually means you have mismatched brackets.

i don't see a close function bracket for init() and there's an extra bracket at the end of your class.

you may be thinking those are a match.  they are not.

in fact, NEVER nest named functions:

function a(){

     function b(){

     }

}

is always problematic.

1 reply

kglad
Community Expert
kgladCommunity ExpertCorrect answer
Community Expert
May 10, 2013

that usually means you have mismatched brackets.

i don't see a close function bracket for init() and there's an extra bracket at the end of your class.

you may be thinking those are a match.  they are not.

in fact, NEVER nest named functions:

function a(){

     function b(){

     }

}

is always problematic.