9 Replies Latest reply on Jul 7, 2009 6:30 AM by kglad

    Movieclip Cannot Access Root Object

    Raidation

      I am making another game, and I'm having a problem with the level loader.

       

       

      My level loader code is this:

      //Start Initiation Rubbish

      stop(); //Ironic, stop in a start section. :P

      Start = function():Void {

      var moving = false;

      var speed = 8;

      var numgems = 0;

      var l1 = new Array();

      for(i = 0; i <= 19; i ++) {

           l1[i] = new Array();

           for(q = 0; q <= 7; q ++) {

                l1[i][q] = 0;

           }

      }

      for(i = 0; i <= 19; i ++) {

           l1[i][0] = 1;

           l1[i][7] = 1;

      }

      for(i = 0; i <= 7; i ++) {

           l1[0][i] = 1;

           l1[19][i] = 1;

      }

      //End Initiation Rubbish

       

       

       

       

       

      //Start Important Stuff

      var array:Array = mc_window.code.split("|");

      //End Important Rubbish, I mean Stuff

       

       

       

       

       

       

      //Start other Rubbish

      var a = 0;

      var w = 0;

      a = 0;

      for(i = 0; i <= 14; i ++) {

           for(q = 0; q <= 19; q ++) {

                l1[q][i] = array[a];

                a ++;

           }

      }

      w = 0;

      for(i = 0; i <= 19; i ++) {

           for(q = 0; q <= 14; q ++) {

                if(l1[i][q] == 1) {

                     mc_wall = _root.attachMovie("mc_wallvisible","mc_wall"+i+"_"+q,w);

                     mc_wall._x = i*32;

                     mc_wall._y = q*32;

                }

                if(l1[i][q] == 4) {

                     mc_spike = _root.attachMovie("mc_spike","mc_spike"+i+"_"+q,w);

                     mc_spike._x = i*32;

                     mc_spike._y = q*32;

                }

                if(l1[i][q] == 3) {

                     mc_gem = _root.attachMovie("mc_gem","mc_gem"+i+"_"+q,w);

                     mc_gem._x = i*32;

                     mc_gem._y = q*32;

                     numgems ++;

                }

                if(l1[i][q] == 5) {

                     mc_hole = _root.attachMovie("mc_hole","mc_hole",w);

                     mc_hole._x = i*32;

                     mc_hole._y = q*32;

                }

                if(l1[i][q] == 6) {

                     mc_breakablewall = _root.attachMovie("mc_breakablewall","mc_breakableblock"+i+"_"+q,w);

                     mc_breakablewall._x = i*32;

                     mc_breakablewall._y = q*32;

                }

                if(l1[i][q] == 7) {

                     mc_teleport = _root.attachMovie("mc_teleport","mc_teleport"+i+"_"+q,w);

                     mc_teleport._x = i*32;

                     mc_teleport._y = q*32;

                }

                if(l1[i][q] == 8) {

                     mc_teleportr = _root.attachMovie("mc_teleportr",mc_teleportr,w);

                     mc_teleportr._x = i*32;

                     mc_teleportr._y = q*32;

                }

                w ++;

           }

      }

      for(i = 0; i <= 19; i ++) {

           for(q = 0; q <= 14; q ++) {

                if(l1[i][q] == 2) {

                     var pposx1 = i;

                     var pposy1 = q;

                }

           }

      }

      var px = pposx1*32;

      var py = pposy1*32;

      _root.attachMovie("mc_playercustom","mc_player",_root.getNextHighestDepth());

      moveUp = function():Void {

           if(l1[pposx1][pposy1-1] != 1 && l1[pposx1][pposy1-1] != 6 && !moving) {

                l1[pposx1][pposy1-1] = 2;

                l1[pposx1][pposy1] = 0;

                pposy1 --;

                moveUp();

           }

      }

      moveDown = function():Void {

           if(l1[pposx1][pposy1+1] != 1 && l1[pposx1][pposy1+1] != 6 && !moving) {

                l1[pposx1][pposy1+1] = 2;

                l1[pposx1][pposy1] = 0;

                pposy1 ++;

                moveDown();

           }

      }

      moveRight = function():Void {

           if(l1[pposx1+1][pposy1] != 1 && l1[pposx1+1][pposy1] != 6 && !moving) {

                l1[pposx1+1][pposy1] = 2;

                l1[pposx1][pposy1] = 0;

                pposx1 ++;

                moveRight();

           }

      }

      moveLeft = function():Void {

           if(l1[pposx1-1][pposy1] != 1 && l1[pposx1-1][pposy1] != 6 && !moving) {

                l1[pposx1-1][pposy1] = 2;

                l1[pposx1][pposy1] = 0;

                pposx1 --;

                moveLeft();

           }

      }

       

      this.onEnterFrame = function() {

           if(Key.isDown(Key.UP)) {

                if(!keyPressed && !moving) {

                     moveUp();

                     keyPressed = true;

                     mc_player.dir = 3;

                }

           }else

           if(Key.isDown(Key.DOWN)) {

                if(!keyPressed && !moving) {

                     moveDown();

                     keyPressed = true;

                     mc_player.dir = 4;

                }

           }else

           if(Key.isDown(Key.RIGHT)) {

                if(!keyPressed && !moving) {

                     moveRight();

                     keyPressed = true;

                     mc_player.dir = 2;

                }

       

       

       

       

           }else

           if(Key.isDown(Key.LEFT)) {

                if(!keyPressed && !moving) {

                     moveLeft();

                     keyPressed = true;

                     mc_player.dir = 1;

                }

           }else

           {

                keyPressed = false;

           }

           if(pposx1*32 > px) {

                px += speed;

                moving = true;

           }

           if(pposx1*32 < px) {

                px -= speed;

                moving = true;

           }

           if(pposy1*32 > py) {

                py += speed;

                moving = true;

           }

           if(pposy1*32 < py) {

                py -= speed;

                moving = true;

           }

           if(pposx1*32 == px && pposy1*32 == py) {

                moving = false;

           }

      }

      }

      I know it's long. Sorry.

       

      My player code is this:

      this.onEnterFrame = function() {

           with(this) {

                _x = _root.px;

                _y = _root.py;

                for(i = 0; i <= 14; i ++) {

                     for(q = 0; q <= 19; q ++) {

                          if(_x == _root["mc_teleport"+q+"_"+i]._x && _y == _root["mc_teleport"+q+"_"+i]._y) {

                               for(w = 0; w <= 14; w ++) {

                                    for(z = 0; z <= 19; z ++) {

                                         if(_root.l1[z][w] == 8) {

                                              _root.l1[z][w] = 2;

                                              _root["mc_teleport"+q+"_"+i].removeMovieClip();

                                              _root.mc_teleportr.removeMovieClip();

                                              _root.pposx1 = z;

                                              _root.pposy1 = w;

                                              _root.px = z*32;

                                              _root.py = w*32;

                                              if(dir == 1) {

                                                   _root.moveLeft();

                                              }

                                              if(dir == 2) {

                                                   _root.moveRight();

                                              }

                                              if(dir == 3) {

                                                   _root.moveUp();

                                              }

                                              if(dir == 4) {

                                                   _root.moveDown();

                                              }

                                         }

                                    }

                               }

                          }

                          if(_x == _root["mc_gem"+q+"_"+i]._x && _y == _root["mc_gem"+q+"_"+i]._y) {

                               _root["mc_gem"+q+"_"+i].removeMovieClip();

                               _root.numgems --;

                          }

                          if(_x == _root["mc_breakableblock"+q+"_"+i]._x+32 && _y == _root["mc_breakableblock"+q+"_"+i]._y && dir == 1) {

                               _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                               _root.l1[q][i] = 0;

                          }

                          if(_x == _root["mc_breakableblock"+q+"_"+i]._x-32 && _y == _root["mc_breakableblock"+q+"_"+i]._y && dir == 2) {

                               _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                               _root.l1[q][i] = 0;

                          }

                          if(_x == _root["mc_breakableblock"+q+"_"+i]._x && _y == _root["mc_breakableblock"+q+"_"+i]._y-32 && dir == 4) {

                               _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                               _root.l1[q][i] = 0;

                          }

                          if(_x == _root["mc_breakableblock"+q+"_"+i]._x && _y == _root["mc_breakableblock"+q+"_"+i]._y+32 && dir == 3) {

                               _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                               _root.l1[q][i] = 0;

                          }

                          if(_x == _root.mc_hole._x && _y == _root.mc_hole._y && _root.numgems == 0) {

                               _root.mc_hole.removeMovieClip();

                               _root.nextFrame();

                               for(w = 0; w <= 14; w ++) {

                                    for(z = 0; z <= 19; z ++) {

                                         if(_root.l1[z][w] == 6) {

                                              _root["mc_breakableblock"+z+"_"+w].removeMovieClip();

                                         }

                                         if(_root.l1[z][w] == 1) {

                                              _root["mc_wall"+z+"_"+w].removeMovieClip();

                                         }

                                         if(_root.l1[z][w] == 4) {

                                              _root["mc_spike"+z+"_"+w].removeMovieClip();

                                         }

                                    }

                               }

                               this.removeMovieClip();

                          }

                          if(_x == _root["mc_spike"+q+"_"+i]._x && _y == _root["mc_spike"+q+"_"+i]._y) {

                               _root["mc_spike"+q+"_"+i].removeMovieClip();

                               _root.mc_hole.removeMovieClip();

                               var lastFrame = _root._currentframe;

                               _root.gotoAndStop(_root._totalframes-2);

                               _root.lastFrame = lastFrame;

                               for(z = 0; z <= 14; z ++) {

                                    for(w = 0; w <= 19; w ++) {

                                         if(_root.l1[w][z] == 6) {

                                              _root["mc_breakableblock"+w+"_"+z].removeMovieClip();

                                         }          

                                         if(_root.l1[w][z] == 1) {

                                              _root["mc_wall"+w+"_"+z].removeMovieClip();

                                         }

                                         if(_root.l1[w][z] == 4) {

                                              _root["mc_spike"+w+"_"+z].removeMovieClip();

                                         }

                                         if(_root.l1[w][z] == 3) {

                                              _root["mc_gem"+w+"_"+z].removeMovieClip();

                                         }

                                    }

                               }

                               delete _root.onEnterFrame;

                               this.removeMovieClip();

                          }

                          if(Key.isDown(82)) {

                               _root.mc_hole.removeMovieClip();

                               var lastFrame = _root._currentframe;

                               _root.gotoAndStop(_root._totalframes-3);

                               _root.lastFrame = lastFrame;

                               for(z = 0; z <= 14; z ++) {

                                    for(w = 0; w <= 19; w ++) {

                                         if(_root.l1[w][z] == 6) {

                                              _root["mc_breakableblock"+w+"_"+z].removeMovieClip();

                                         }          

                                         if(_root.l1[w][z] == 1) {

                                              _root["mc_wall"+w+"_"+z].removeMovieClip();

                                         }

                                         if(_root.l1[w][z] == 4) {

                                              _root["mc_spike"+w+"_"+z].removeMovieClip();

                                         }

                                         if(_root.l1[w][z] == 3) {

                                              _root["mc_gem"+w+"_"+z].removeMovieClip();

                                         }

                                    }

                               }

                               delete _root.onEnterFrame;

                               this.removeMovieClip();

                          }

                     }

                }

           }

           gotoAndStop(dir);

      }

      I've already debugged this, and it appears that the mc_player movieclip is unable to access any of the _root variables, rendering it useless.

       

      The level loader shows all the other objects and the variables work fine, but when I try to trace _root.px in the player, it returns undefined.

       

       

      So can anybody help me?

      I have an swf of it attached.

        • 1. Re: Movieclip Cannot Access Root Object
          kglad Adobe Community Professional & MVP

          use the trace function to narrow the problem.

          • 2. Re: Movieclip Cannot Access Root Object
            Raidation Level 1

            I know.

            I already did.

             

            I said that it couldn't access the root variables. Like _root.px and _root.py. It returns undefined.

            • 3. Re: Movieclip Cannot Access Root Object
              kglad Adobe Community Professional & MVP

              then put a trace() after you assign a value to those variables and make sure they're defined before your movieclip tries to access those variables.

              • 4. Re: Movieclip Cannot Access Root Object
                Raidation Level 1

                I did.

                Those variables are all working fine.

                • 5. Re: Movieclip Cannot Access Root Object
                  kglad Adobe Community Professional & MVP

                  and are they defined before your movieclip is trying to access them.  if yes, then your movieclip is in a different level than your variables.  use trace(_root) in both to confirm and find the correct path to your variables.

                  • 6. Re: Movieclip Cannot Access Root Object
                    Raidation Level 1

                    I tried it.

                    They're both on _level0

                     

                    The normal levels work fine, but the custom level is the same as the normal levels, but just with a String.split to generate the array.

                    • 7. Re: Movieclip Cannot Access Root Object
                      kglad Adobe Community Professional & MVP

                      then your movieclip is trying to access the variables before they're defined.

                      • 8. Re: Movieclip Cannot Access Root Object
                        Raidation Level 1

                        No, if you look at the code, the movieclip is attached after the px and py variables are defined.

                        • 9. Re: Movieclip Cannot Access Root Object
                          kglad Adobe Community Professional & MVP

                          copy and paste a few seconds of the output that results from the following:


                           

                          //Start Initiation Rubbish

                          stop(); //Ironic, stop in a start section.

                          Start = function():Void {

                          var moving = false;

                          var speed = 8;

                          var numgems = 0;

                          var l1 = new Array();

                          for(i = 0; i <= 19; i ++) {

                               l1[i] = new Array();

                               for(q = 0; q <= 7; q ++) {

                                    l1[i][q] = 0;

                               }

                          }

                          for(i = 0; i <= 19; i ++) {

                               l1[i][0] = 1;

                               l1[i][7] = 1;

                          }

                          for(i = 0; i <= 7; i ++) {

                               l1[0][i] = 1;

                               l1[19][i] = 1;

                          }

                          //End Initiation Rubbish

                           

                           

                           

                           

                           

                          //Start Important Stuff

                          var array:Array = mc_window.code.split("|");

                          //End Important Rubbish, I mean Stuff

                           

                           

                           

                           

                           

                           

                          //Start other Rubbish

                          var a = 0;

                          var w = 0;

                          a = 0;

                          for(i = 0; i <= 14; i ++) {

                               for(q = 0; q <= 19; q ++) {

                                    l1[q][i] = array[a];

                                    a ++;

                               }

                          }

                          w = 0;

                          for(i = 0; i <= 19; i ++) {

                               for(q = 0; q <= 14; q ++) {

                                    if(l1[i][q] == 1) {

                                       &n bsp; mc_wall = _root.attachMovie("mc_wallvisible","mc_wall"+i+"_"+q,w);

                                       &n bsp; mc_wall._x = i*32;

                                       &n bsp; mc_wall._y = q*32;

                                    }

                                    if(l1[i][q] == 4) {

                                       &n bsp; mc_spike = _root.attachMovie("mc_spike","mc_spike"+i+"_"+q,w);

                                       &n bsp; mc_spike._x = i*32;

                                       &n bsp; mc_spike._y = q*32;

                                    }

                                    if(l1[i][q] == 3) {

                                       &n bsp; mc_gem = _root.attachMovie("mc_gem","mc_gem"+i+"_"+q,w);

                                       &n bsp; mc_gem._x = i*32;

                                       &n bsp; mc_gem._y = q*32;

                                       &n bsp; numgems ++;

                                    }

                                    if(l1[i][q] == 5) {

                                       &n bsp; mc_hole = _root.attachMovie("mc_hole","mc_hole",w);

                                       &n bsp; mc_hole._x = i*32;

                                       &n bsp; mc_hole._y = q*32;

                                    }

                                    if(l1[i][q] == 6) {

                                       &n bsp; mc_breakablewall = _root.attachMovie("mc_breakablewall","mc_breakableblock"+i+"_"+q,w);

                                       &n bsp; mc_breakablewall._x = i*32;

                                       &n bsp; mc_breakablewall._y = q*32;

                                    }

                                    if(l1[i][q] == 7) {

                                       &n bsp; mc_teleport = _root.attachMovie("mc_teleport","mc_teleport"+i+"_"+q,w);

                                       &n bsp; mc_teleport._x = i*32;

                                       &n bsp; mc_teleport._y = q*32;

                                    }

                                    if(l1[i][q] == 8) {

                                       &n bsp; mc_teleportr = _root.attachMovie("mc_teleportr",mc_teleportr,w);

                                       &n bsp; mc_teleportr._x = i*32;

                                       &n bsp; mc_teleportr._y = q*32;

                                    }

                                    w ++;

                               }

                          }

                          for(i = 0; i <= 19; i ++) {

                               for(q = 0; q <= 14; q ++) {

                                    if(l1[i][q] == 2) {

                                       &n bsp; var pposx1 = i;

                                       &n bsp; var pposy1 = q;

                                    }

                               }

                          }

                          var px = pposx1*32;

                          var py = pposy1*32;

                          trace(this+" "+px+" "+py);

                          _root.attachMovie("mc_playercustom","mc_player",_root.getNextHighestDepth());

                          moveUp = function():Void {

                               if(l1[pposx1][pposy1-1] != 1 && l1[pposx1][pposy1-1] != 6 && !moving) {

                                    l1[pposx1][pposy1-1] = 2;

                                    l1[pposx1][pposy1] = 0;

                                    pposy1 --;

                                    moveUp();

                               }

                          }

                          moveDown = function():Void {

                               if(l1[pposx1][pposy1+1] != 1 && l1[pposx1][pposy1+1] != 6 && !moving) {

                                    l1[pposx1][pposy1+1] = 2;

                                    l1[pposx1][pposy1] = 0;

                                    pposy1 ++;

                                    moveDown();

                               }

                          }

                          moveRight = function():Void {

                               if(l1[pposx1+1][pposy1] != 1 && l1[pposx1+1][pposy1] != 6 && !moving) {

                                    l1[pposx1+1][pposy1] = 2;

                                    l1[pposx1][pposy1] = 0;

                                    pposx1 ++;

                                    moveRight();

                               }

                          }

                          moveLeft = function():Void {

                               if(l1[pposx1-1][pposy1] != 1 && l1[pposx1-1][pposy1] != 6 && !moving) {

                                    l1[pposx1-1][pposy1] = 2;

                                    l1[pposx1][pposy1] = 0;

                                    pposx1 --;

                                    moveLeft();

                               }

                          }

                           

                          this.onEnterFrame = function() {

                               if(Key.isDown(Key.UP)) {

                                    if(!keyPressed && !moving) {

                                       &n bsp; moveUp();

                                       &n bsp; keyPressed = true;

                                       &n bsp; mc_player.dir = 3;

                                    }

                               }else

                               if(Key.isDown(Key.DOWN)) {

                                    if(!keyPressed && !moving) {

                                       &n bsp; moveDown();

                                       &n bsp; keyPressed = true;

                                       &n bsp; mc_player.dir = 4;

                                    }

                               }else

                               if(Key.isDown(Key.RIGHT)) {

                                    if(!keyPressed && !moving) {

                                       &n bsp; moveRight();

                                       &n bsp; keyPressed = true;

                                       &n bsp; mc_player.dir = 2;

                                    }

                           

                           

                           

                           

                               }else

                               if(Key.isDown(Key.LEFT)) {

                                    if(!keyPressed && !moving) {

                                       &n bsp; moveLeft();

                                       &n bsp; keyPressed = true;

                                       &n bsp; mc_player.dir = 1;

                                    }

                               }else

                               {

                                    keyPressed = false;

                               }

                               if(pposx1*32 > px) {

                                    px += speed;

                                    moving = true;

                               }

                               if(pposx1*32 < px) {

                                    px -= speed;

                                    moving = true;

                               }

                               if(pposy1*32 > py) {

                                    py += speed;

                                    moving = true;

                               }

                               if(pposy1*32 < py) {

                                    py -= speed;

                                    moving = true;

                               }

                               if(pposx1*32 == px && pposy1*32 == py) {

                                    moving = false;

                               }

                          }

                          }

                          I know it's long. Sorry.

                           

                          My player code is this:

                           

                           

                          this.onEnterFrame = function() {

                               with(this) {

                                    _x = _root.px;

                                    _y = _root.py;

                          trace(_root.px+" "+_root.py);

                                    for(i = 0; i <= 14; i ++) {

                                       &n bsp; for(q = 0; q <= 19; q ++) {

                                       &n bsp;      if(_x == _root["mc_teleport"+q+"_"+i]._x && _y == _root["mc_teleport"+q+"_"+i]._y) {

                                       &n bsp;           for(w = 0; w <= 14; w ++) {

                                       &n bsp;            &nbs p;   for(z = 0; z <= 19; z ++) {

                                       &n bsp;            &nbs p;        if(_root.l1[z][w] == 8) {

                                       &n bsp;            &nbs p;             _root.l1[z][w] = 2;

                                       &n bsp;            &nbs p;             _root["mc_teleport"+q+"_"+i].removeMovieClip();

                                       &n bsp;            &nbs p;             _root.mc_teleportr.removeMovieClip();

                                       &n bsp;            &nbs p;             _root.pposx1 = z;

                                       &n bsp;            &nbs p;             _root.pposy1 = w;

                                       &n bsp;            &nbs p;             _root.px = z*32;

                                       &n bsp;            &nbs p;             _root.py = w*32;

                                       &n bsp;            &nbs p;             if(dir == 1) {

                                       &n bsp;            &nbs p;                   _root.moveLeft();

                                       &n bsp;            &nbs p;             }

                                       &n bsp;            &nbs p;             if(dir == 2) {

                                       &n bsp;            &nbs p;                   _root.moveRight();

                                       &n bsp;            &nbs p;             }

                                       &n bsp;            &nbs p;             if(dir == 3) {

                                       &n bsp;            &nbs p;                   _root.moveUp();

                                       &n bsp;            &nbs p;             }

                                       &n bsp;            &nbs p;             if(dir == 4) {

                                       &n bsp;            &nbs p;                   _root.moveDown();

                                       &n bsp;            &nbs p;             }

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;   }

                                       &n bsp;           }

                                       &n bsp;      }

                                       &n bsp;      if(_x == _root["mc_gem"+q+"_"+i]._x && _y == _root["mc_gem"+q+"_"+i]._y) {

                                       &n bsp;           _root["mc_gem"+q+"_"+i].removeMovieClip();

                                       &n bsp;           _root.numgems --;

                                       &n bsp;      }

                                       &n bsp;      if(_x == _root["mc_breakableblock"+q+"_"+i]._x+32 && _y == _root["mc_breakableblock"+q+"_"+i]._y && dir == 1) {

                                       &n bsp;           _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                                       &n bsp;           _root.l1[q][i] = 0;

                                       &n bsp;      }

                                       &n bsp;      if(_x == _root["mc_breakableblock"+q+"_"+i]._x-32 && _y == _root["mc_breakableblock"+q+"_"+i]._y && dir == 2) {

                                       &n bsp;           _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                                       &n bsp;           _root.l1[q][i] = 0;

                                       &n bsp;      }

                                       &n bsp;      if(_x == _root["mc_breakableblock"+q+"_"+i]._x && _y == _root["mc_breakableblock"+q+"_"+i]._y-32 && dir == 4) {

                                       &n bsp;           _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                                       &n bsp;           _root.l1[q][i] = 0;

                                       &n bsp;      }

                                       &n bsp;      if(_x == _root["mc_breakableblock"+q+"_"+i]._x && _y == _root["mc_breakableblock"+q+"_"+i]._y+32 && dir == 3) {

                                       &n bsp;           _root["mc_breakableblock"+q+"_"+i].removeMovieClip();

                                       &n bsp;           _root.l1[q][i] = 0;

                                       &n bsp;      }

                                       &n bsp;      if(_x == _root.mc_hole._x && _y == _root.mc_hole._y && _root.numgems == 0) {

                                       &n bsp;           _root.mc_hole.removeMovieClip();

                                       &n bsp;           _root.nextFrame();

                                       &n bsp;           for(w = 0; w <= 14; w ++) {

                                       &n bsp;            &nbs p;   for(z = 0; z <= 19; z ++) {

                                       &n bsp;            &nbs p;        if(_root.l1[z][w] == 6) {

                                       &n bsp;            &nbs p;             _root["mc_breakableblock"+z+"_"+w].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;        if(_root.l1[z][w] == 1) {

                                       &n bsp;            &nbs p;             _root["mc_wall"+z+"_"+w].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;        if(_root.l1[z][w] == 4) {

                                       &n bsp;            &nbs p;             _root["mc_spike"+z+"_"+w].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;   }

                                       &n bsp;           }

                                       &n bsp;           this.removeMovieClip();

                                       &n bsp;      }

                                       &n bsp;      if(_x == _root["mc_spike"+q+"_"+i]._x && _y == _root["mc_spike"+q+"_"+i]._y) {

                                       &n bsp;           _root["mc_spike"+q+"_"+i].removeMovieClip();

                                       &n bsp;           _root.mc_hole.removeMovieClip();

                                       &n bsp;           var lastFrame = _root._currentframe;

                                       &n bsp;           _root.gotoAndStop(_root._totalframes-2);

                                       &n bsp;           _root.lastFrame = lastFrame;

                                       &n bsp;           for(z = 0; z <= 14; z ++) {

                                       &n bsp;            &nbs p;   for(w = 0; w <= 19; w ++) {

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 6) {

                                       &n bsp;            &nbs p;             _root["mc_breakableblock"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }         

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 1) {

                                       &n bsp;            &nbs p;             _root["mc_wall"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 4) {

                                       &n bsp;            &nbs p;             _root["mc_spike"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 3) {

                                       &n bsp;            &nbs p;             _root["mc_gem"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;   }

                                       &n bsp;           }

                                       &n bsp;           delete _root.onEnterFrame;

                                       &n bsp;           this.removeMovieClip();

                                       &n bsp;      }

                                       &n bsp;      if(Key.isDown(82)) {

                                       &n bsp;           _root.mc_hole.removeMovieClip();

                                       &n bsp;           var lastFrame = _root._currentframe;

                                       &n bsp;           _root.gotoAndStop(_root._totalframes-3);

                                       &n bsp;           _root.lastFrame = lastFrame;

                                       &n bsp;           for(z = 0; z <= 14; z ++) {

                                       &n bsp;            &nbs p;   for(w = 0; w <= 19; w ++) {

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 6) {

                                       &n bsp;            &nbs p;             _root["mc_breakableblock"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }         

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 1) {

                                       &n bsp;            &nbs p;             _root["mc_wall"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 4) {

                                       &n bsp;            &nbs p;             _root["mc_spike"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;        if(_root.l1[w][z] == 3) {

                                       &n bsp;            &nbs p;             _root["mc_gem"+w+"_"+z].removeMovieClip();

                                       &n bsp;            &nbs p;        }

                                       &n bsp;            &nbs p;   }

                                       &n bsp;           }

                                       &n bsp;           delete _root.onEnterFrame;

                                       &n bsp;           this.removeMovieClip();

                                       &n bsp;      }

                                       &n bsp; }

                                    }

                               }

                               gotoAndStop(dir);

                          }