1 Reply Latest reply on Feb 9, 2007 2:24 AM by Newsgroup_User

    Script on another layer

    stuart_lynch
      I"m trying to work with this play backwards script inside of two levels or two movie levels
      It's a very rudimentary look, I'd prefer to get it working before I add the real 3d elements.

      http://www.project1media.com/testlevel.zip

      I'm very desperate at this point and my understanding of _root levels etc is somewhat primitive,
      although my site www.project1media.com is pretty heavy on basic coding

      My only question is, why won't this script work inside of a clip.



        • 1. Re: Script on another layer
          Level 7
          Hi!

          Modifications in your code:
          if (this._currentframe > _root.mytarget){
          prevFrame();

          }else if (this._currentframe < _root.mytarget){

          Note the change of _root. to this.

          _root points to the toplevel of the movie, and that is not the level where
          you want to change frames in (the top level has only 1 frame!). You want to
          change frames in the level where your code is placed (for this particular
          case).

          You can think of levels as boxes inside boxes. So the first box is the main
          level, and then in your particular case Symbol 1 is a box inside the "_root
          box" (or first box), and then Symbol 2 is a box inside the "symbol 1 box".
          The word "this." points to the box where it is encountered at runtime and
          the word "_root." will always point to the first box.

          Also, a good code pratice is to gather all your code (if possible) in the
          first frame of the first box. (This would of course require changining your
          code). This is not always so easy, and requires experience. But it is
          something to strive for, and it will help on debugging and structureing your
          code.

          /Jensen/

          "stuart_lynch" <webforumsuser@macromedia.com> wrote in message
          news:eqhh77$11e$1@forums.macromedia.com...
          > I"m trying to work with this play backwards script inside of two levels or
          > two
          > movie levels
          > It's a very rudimentary look, I'd prefer to get it working before I add
          > the
          > real 3d elements.
          >
          > http://www.project1media.com/testlevel.zip
          >
          > I'm very desperate at this point and my understanding of _root levels etc
          > is
          > somewhat primitive,
          > although my site www.project1media.com is pretty heavy on basic coding
          >
          > My only question is, why won't this script work inside of a clip.
          >
          >
          >
          >
          >