5 Replies Latest reply on Sep 4, 2013 6:41 AM by kglad

    Highest Depth Text?

    hokayli2

      Hi I'm making a tile Based game in as2 and my text variable is TalkText but the highest depth does not work and text still gets covered by the tiles

       

       

       

      _root.TalkText="hello there ", _root.getNextHighestDepth();

       

       

       

       

      I want it to load with space key and want to hide it as well if not in contact with other character using something like this.

       

       

       

       

      if (_root.placeChar.hitTest(this)) {

                          if (Key.isDown(Key.SPACE)) {

       

       

       

       

                                    }

                } else {

       

       

       

                }

      }

        • 1. Re: Highest Depth Text?
          kglad Adobe Community Professional & MVP

          you must publish for flash player 7 or better.

           

          in addition, you must use a movieclip (or additional code).  the easiest thing to do is to convert your textfield to a movieclip, assign an instance name (eg, tf_mc) and apply swapDepths():

           

           

          tf_mc.swapDepths(this.getNextHighestDepth());

          • 2. Re: Highest Depth Text?
            hokayli2 Level 1

            Thanks for the help but this only works when I don't have tiles, when I load it with tiles the game tiles still cover it.

             

            what I placed

             

            if (_root.placeChar.hitTest(this)) {

                                if (Key.isDown(Key.SPACE)) {

                                          _root.tf_mc.swapDepths(this.getNextHighestDepth());

                                           girlmoving1 = false;

             

                                          }

                      } else {

             

                                girlmoving1 = true;

                      }

            }

             

             

             

             

             

            How I programmed one of the tiles maybe something there could be stopping it from working?

             

            function aT1(){

                      if(xTile>=400){

                                xTile=0;

                                yTile+=50;

                                tile1Copy.duplicateMovieClip("tile1"+tileDepth, tileDepth);

                      }else

                      tile1Copy.duplicateMovieClip("tile1"+tileDepth, tileDepth);

                      _root["tile1"+tileDepth]._x=xTile;

                      _root["tile1"+tileDepth]._y=yTile;

                      xTile+=50;

                      tileDepth++;

            }

            • 3. Re: Highest Depth Text?
              kglad Adobe Community Professional & MVP

              after calling aT1 you need to execute:

               

                _root.tf_mc.swapDepths(_root.getNextHighestDepth());

              1 person found this helpful
              • 4. Re: Highest Depth Text?
                hokayli2 Level 1

                Thanks so much this worked perfectly! I really appreciate your help.

                • 5. Re: Highest Depth Text?
                  kglad Adobe Community Professional & MVP

                  you're welcome.