3 Replies Latest reply on Oct 21, 2009 9:38 PM by webqaflash

    (AS2) instance name + variable

    OmegaVitaminC

      i have 3 symbols: box1, box2, and box3.

      i want them to move when i press the spacebar.

      press spacebar once will make the first one move. the second time, the second box will move, and so on.

       

      1. var whichbox:Number=1;

      2. var pressed:Boolean=false;

      3. onEnterFrame=function(){

      4. if(whichbox==4){

      5. whichbox=1;

      6. }

      7. if(!Key.isDown(Key.SPACE) && pressed==true){

      8. pressed=false;

      9. }

      10. if(Key.isDown(Key.SPACE) && pressed==false){

      11. _root.box+whichbox._y+=50;

      12. whichbox+=1;

      13. pressed=true;

      14. }

      15. }

       

      i assume the problem is in line 11, right?

      what did i do wrong there?