A Flash Developer Resource Site

Results 1 to 4 of 4

Thread: 'else' encounterd without matching 'if' HELP

  1. #1
    Junior Member
    Join Date
    Oct 2004
    Posts
    4

    'else' encounterd without matching 'if' HELP

    This is my Code i keep getting the error message 'else' encountered without matching 'if'

    function moveLasers() {
    if(laserReady&& Key.isDown(Key.SPACE))
    laserReady = false;
    currentTime = getTimer();
    createlaser();
    }else{
    if(currentTime+laserDelay<=getTimer()){
    laserReady=true;
    }
    }

  2. #2
    Junior Member
    Join Date
    Dec 2009
    Posts
    11
    The problem is you have missed the prase follow by if statement.

    function moveLasers() {
    if(laserReady && Key.isDown(Key.SPACE)) {
    laserReady = false;
    currentTime = getTimer();
    createlaser();
    }else{
    if(currentTime+laserDelay<=getTimer()){
    laserReady=true;
    }
    }

  3. #3
    Member
    Join Date
    Jan 2008
    Posts
    37
    add one more } is what i believe Johnny was trying to say.

  4. #4
    var x:Number = 1; x /= 0;
    Join Date
    Dec 2004
    Posts
    549
    no...add one { after the if statement.
    Z¡µµ¥ D££

    Soup In A Box

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