3 Replies Latest reply on Jul 21, 2006 2:43 AM by dbohea

    Calling handlers in LDMs

    dbohea
      Hello again folks.

      Can anybody give me any tips on calling handlers in LDMs?

      I have a linked Director movie 'Game' sat in the sprite channel of a 'host' Director movie 'Interface'. I'm trying to trigger the handler 'loadGame' located in a movie script inside the LDM 'Game' from the Interface movie. Can this be done?

      If it can't be done, I can re-write my code to work the other way around and place the handler in the 'Interface' movie and trigger it from the LDM 'Game'. Can this be done?

      I did find a post on this forum that seemed to get pretty close but I can't seem to get it to work. Search 'LDM Lingo' to find the post that I'm referring to.

      Come on people - you've yet to let me down.
        • 1. Re: Calling handlers in LDMs
          a¿ex Level 1
          tell sprite(xy) to loadGame

          you can handle it just like a miaw with tell you change the scope to the one of the embedded movie:

          tell sprite(xy)
          loadGame
          end tell

          as you would do with a miaw

          tell window(xy)
          loadGame
          end tell


          ------------------------------

          in case you use director 10 or greater (it's always a good iudea to add that info, if you ask something btw)
          you can also use the new DOM syntax to access the LDM movie scope directly through sprite(xy)._movie

          sprite(xy)._movie.loadGame()


          -----------

          the "tell" route works very solid, as it is there since many moons now. but there are some issues with the way director references for example members or sprites. in your case, where it is simply to send a global movie level event, there is no problem with either method.
          • 2. Re: Calling handlers in LDMs
            Level 7
            > you can also use the new DOM syntax to access the LDM movie scope directly
            > through sprite(xy)._movie
            >
            > sprite(xy)._movie.loadGame()

            On minor correction - that should be:
            sprite(xy).movie.loadGame()
            • 3. Re: Calling handlers in LDMs
              dbohea Level 1
              Ooops!

              That's what I've been doing all along.

              Turns out that the handler in my LDM was sat in a behaviour script rather than a movie script.

              It's amazing what a cup of tea, a long break and some fresh eyes can do.