A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: [RESOLVED] [Problem] (Flash 8) Syntax Error I don't understand...

Threaded View

  1. #1
    Join Date
    Apr 2009

    resolved [RESOLVED] [Problem] (Flash 8) Syntax Error I don't understand...

    So I was trying to make a game like this one:


    When I tested it, an error report popped up that said the following:

    **Error** Scene=Scene 1, layer=Game, frame=2:Line 1: Statement block must be terminated by '}'
    onClipEvent(enterFrame) {

    **Error** Scene=Scene 1, layer=Game, frame=2:Line 21: Syntax error.
    } //end the onClipEvent handler

    Total ActionScript Errors: 2 Reported Errors: 2

    It's referring to the code for the tank that the player controls:

    onClipEvent(enterFrame) {
    if(this._x<=0) this._x=2; //0 is the left boundary for my invader, you may want to change your's
    if(this._x>=580) this._x=478; //480 is the right boundary, feel free to change!
    if(this._x>80 && this._x<480) { //just to make sure that the ship is in a valid position
    if (Key.isDown (Key.RIGHT) ) { //right key is down
    this._x+=5 //5 is the speed, this moves the clip 5 to the right
    else if (Key.isDown (Key.LEFT) ) {
    this._x-=5 // moves the clip 5 to the left

    if(Key.isDown (Key.SPACE) ) { //space key is down

    if(_root.bullet._y>600) { //checks to see if the bullet is off the screen (so you can fire again)
    bullet._x=this._x //sets the bullet's x to your x

    bullet._y=this._y //sets the bullet's y to your y

    } //end the onClipEvent handler

    Last edited by medfoe; 04-24-2009 at 07:02 PM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Click Here to Expand Forum to Full Width

HTML5 Development Center