3 Replies Latest reply on Jan 15, 2008 6:43 AM by Newsgroup_User

    Any way to scroll the viewport of a cropped LDM?

    Applied CD Level 1
      I’m modifying Openspark’s vertical scroll bar example ( http://nonlinear.openspark.com/tips/oop/scrollBar/index.htm) to allow both vertical and horizontal scroll bars on the same LDM. Essentially these scripts cycle through every sprite in the LDM and move them a given increment. It works well enough but I’m banging my head against the wall thinking there must be a way to modify the viewport of an LDM in similar fashion to scrolling an MIAW with drawRect. Does anyone know some tricks or is moving every sprite individually really the best way?
        • 1. Re: Any way to scroll the viewport of a cropped LDM?
          Level 7

          On ma, 2008-01-14 at 19:41 +0000, Applied CD wrote:
          > I?m modifying Spenspark?s vertical scroll bar example
          > ( http://nonlinear.openspark.com/tips/oop/scrollBar/index.htm) to
          > allow both
          > vertical and horizontal scroll bars on the same LDM. Essentially
          > these scripts
          > cycle through every sprite in the LDM and move them a given
          > increment. It works
          > well enough but I?m banging my head against the wall thinking there
          > must be a
          > way to modify the viewport of an LDM in similar fashion to scrolling
          > an MIAW
          > with drawRect. Does anyone know some tricks or is moving every
          > sprite
          > individually really the best way?
          >

          Hi again,

          I dont have another solution for this.
          I have done some experimenting, but can not find a way to "change the
          viewport" either.
          I was hoping something like "tell sprite() to set the rect of the
          stage
          to rect()" would work, but it sets the rect of the main-stage, not the
          rect of the LDM-stage. I think this is one of the shortcomings of
          LDM's.

          Years ago there was an aticle on one of the Director lingo sites about
          linked Director movies, and the tricks you can play with them.
          But... you guessed it, I can not remember.
          It was something with clocks... maybe google can help?

          I even tried to use the Shockwave ActiveX, hoping it would play the
          extenal movie with scrollbars. But the only thing I get is an
          immediate
          Director crash. :(

          The moving of the sprites is not that bad.
          You can make 1 generic behaviour for all the sprites, that moves the
          sprite with an extra offset.

          Something like:

          property myStartLoc
          global gOffset

          on beginSprite me
          myStartLoc = the loc of sprite(me.spriteNum)
          end

          on prepareFrame me
          set the loc of sprite(me.spriteNum) to myStartLoc + gOffset
          end

          You can now change the value of gOffset right in the main movie, to
          move
          all the sprites with this behaviour.
          gOffset should be a rect.

          Good luck,
          let me know how it goes.

          Richard.




          • 2. Re: Any way to scroll the viewport of a cropped LDM?
            Level 7
            LOOPING_Richard wrote:
            > Years ago there was an aticle on one of the Director lingo sites about
            > linked Director movies, and the tricks you can play with them.
            > But... you guessed it, I can not remember.
            > It was something with clocks...

            http://director-online.com/buildArticle.php?id=439

            Andrew


            • 3. Any way to scroll the viewport of a cropped LDM?
              Applied CD Level 1
              Thanks Richard, despite the scrolling issue I’m staying with the LDM approach … it just feels like it has fewer drawbacks than the MIAW.

              What I’ve got so far is a single behavior that can be attached to the LDM sprite. This one behavior is responsible for moving everything inside the LDM. It’s based on a massive simplification of Openspark’s example. I’ve attached what I’ve got so far, it’s not done (no limit checks, only loops through first 50 sprites in LDM, etc…) but you can see that it relies on tell <LDM sprite> to redirect the command stream to effect sprites inside the LDM rather than the host. It works but I’m a little concerned about the TELL command … I can’t seem to find if it’s depreciated or simply undocumented.

              Just for the record here’s a link to the clock tutorial:

              http://director-online.com/buildArticle.php?id=439

              and another link to known bugs/workarounds for LDM’s (mostly issues involving rollovers):

              http://director-online.com/dougwiki/index.php/Linked_Director_Movies