2 Replies Latest reply on Jul 25, 2006 6:36 AM by the_flex_newbie

    Logo Game

    the_flex_newbie
      I am pretty new to Flex 2 and have only got it on trial, so excuse my lack of flex and actionscript knoledge.

      I am eager to learn and want to make a simple game. The game is based on general knoledge. There will be 5 thumbnails down the left hand side of a panel. The thumbs will be of well-known logos, such as McDonalds, Burger King, Disney, etc. Next to each thumbnail will be a TextInput box and next to each of those will be a uneditable text box.

      What I want to do is to program it so that if the user enters the correct name for the logo in the TextInput box, the uneditable text box will say "correct!". Also when the user has entered nothing, or the incorrect answer, the uneditable text box will say incorrect. I think that you have to use actionscript, but I don't know how to use it with the IF command correctly.

      I have started the project and this is all I have got. When I try to run it, it errors.

      I would like to also have a small title screen that says how to play the game. I understand that you have to use states and have a button that has the code that is something lke this click"changeState". And when it does change state, I would like it to use a transitional effect so that the size changes smoothly.

      Thanks in advance for any replies.
        • 1. Re: Logo Game
          ntsiii Level 3
          You are getting an error because you have the "if" in the outside script block when it must be within a function.

          Something like:

          private function validatePlay():void {
          if (gamecubeInput.text==gamecube) {
          gamecubeAnswer.text="Correct"
          }
          else {
          gamecubeAnswer.text="Incorrect"
          }
          }

          and im the mxml:
          <mx:Button click="validatePlay()" x="266" y="43" label="Validate" id="gamecubeValidate" />
          • 2. Re: Logo Game
            the_flex_newbie Level 1
            Thanks mate, that was a real help. I have now got the basic functionality of the game working.

            I would like to have a title screen so that i can show the user the instructions. Also, when the user clicks "play" I would like it to change state to the main game state. I know how to do this with a button control and the mxml code onClick, however I do not know how to use the transition effects so that there is an animated transition.

            Any replies would be greatly apprectiated.