2 Replies Latest reply on Jul 16, 2006 10:00 AM by bibliomania

    Button code

      I have a swf that loads into a master swf. I've placed a button on the swf that's going into the master that onRelease needs to advance the user to the next frame in the master swf but I can't figure out how to make it work (am still on training wheels with actionscript). Am I wrong in thinking the code needs to be in the swf with the button or should it be in the master swf as some kind of listener? Hope this makes sense. Any help would be appreciated!
        • 1. Re: Button code
          blemmo Level 1
          It's both possible. I'd say the easier way is to have the code in the loaded swf and point it to the master. You could use _root for that, or _levelX if it's loaded into another level, or maybe the safest way, use _parent to get to the master. E.g.:
          btn.onRelease = function(){

          'this' inside the button code refers to the button itself, the _parent would get the movie that contains the button (the loaded one), the next _parent would get to the movie that contains this movie, which should be your master.swf.
          The good thing about this _parent structure is that you could nest the master.swf in other movies and it would still work, where _root or _levelX wouldn't, because they always get to the base of the movie structure.

          • 2. Re: Button code
            bibliomania Level 1
            Worked like a charm. Thanks!