3 Replies Latest reply on Apr 24, 2016 4:16 PM by Colin Holgate

    Escape game

    Brittany0329

      I found a tutorial to create an escape game.  I'm doing it to reveal a surprise trip for my little sisters birthday so I just wanted something simple.  I am new to Animate and coding.  I keep get the following errors:

       

      Scene 1, Layer 'ActionScript', Frame 1, Line 69, Column 181084: Syntax error: expecting identifier before assign.
      Scene 1, Layer 'ActionScript', Frame 1, Line 69, Column 231084: Syntax error: expecting rightparen before leftbrace.

       

      Here is what I have in the ActionScript:

       

      function objectFound(event:MouseEvent):void {

      var inventoryName:String = "inventory" + event.target.name;

      var inventoryItem:DisplayObject = getChildByName(inventoryName);

      event.target.alpha = inventoryItem.alpha = 100;

      founditems ++;

      event.target.alpha = 0;

      if (founditems = = 4) {

      door_btn.addEventListener(MouseEvent.MOUSE_DOWN, escapeRoom);

      }

      }

       

      I tried to attach the tutorial but couldn't.  It is called FLASH CLASSROOM TUTORIAL—MAKE AN ESCAPE THE ROOM GAME IN FLASH CS5.5.

       

      Any help would be greatly appreciated.

        • 1. Re: Escape game
          kglad Adobe Community Professional & MVP

          there's no space between the double equal:

           

          if (founditems = = 4) {

           

          should be

           

          if (founditems == 4) {

           

          p.s. in the future, indicate the problematic line numbers when posting code

          1 person found this helpful
          • 2. Re: Escape game
            Brittany0329 Level 1

            I did what you said and now I have this:

             

            Scene 1, Layer 'ActionScript', Frame 1, Line 12, Column 24

            1071: Syntax error: expected a definition keyword (such as function) after attribute Car_mc, not addEventListener.

             

             

            Here is the code:

             

            12-Car_mc addEventListener(MouseEvent.MOUSE_DOWN, objectFound);

            13-Escape_mc addEventListener(MouseEvent.MOUSE_DOWN, objectFound);

            14-Map_mc addEventListener(MouseEvent.MOUSE_DOWN, objectFound);

            15-Balloon_mc addEventListener(MouseEvent.MOUSE_DOWN, objectFound);

            • 3. Re: Escape game
              Colin Holgate MVP & Adobe Community Professional

              Alpha values are 0 - 1, not 0 - 100. In one script you correctly say door_btn.addEventListener(), but in your lines 12-15 example you have a space character where the period should be.

              1 person found this helpful