2 Replies Latest reply on Jan 22, 2007 2:02 PM by Newsgroup_User

    Loop prb!

    Level 7
      I have a problem with a sort of VR-movie made in Director MX 2004. It´s
      about 40 pics on a camera in diffrent positions so I can rotate it around an
      axis in the window. I have two buttons to make the movie to go to right and
      left. My prb is that when mouse is over the left or right button it should
      roll the movie to the left or right and when I click it should stop. How do
      I script that?
      I have tried with
      on mouseOver me
      go to the frame +1 (and of course go to the frame -1)
      end
      Works but I have to move out and inside the button all the time :( I will
      have it to continue untill I left the button with my mouse.
      Anyone having an idea?
      /Una


        • 1. Re: Loop prb!
          Level 7
          Hi Una,

          I assume you've created your sequence of images in the score. In the Score'
          scripting channel, make sure you have a pause behavior over the entire sequence
          as follows:
          on exitFrame
          go the frame
          end

          next for your forward button use:
          on mouseWithin me
          go the frame + 1
          end

          and the same for your reverse (except -1).

          The 'mouseWithin' will keep updating while the mouse is over the the sprite
          area. The one problem is that it may cycle very quickly. It will stop as soon as
          you move the mouse off the sprite.

          Another thing you could do - to ensure the cycle speed follows your set frame
          rate - is to use a global variable to define your 'playstate' (whether it's
          forward, reverse or stopped). Say we create a variable galled gPlayState and we
          have 3 possible values - 0 for stopped, -1 for reverse and 1 for forward. We can
          change the paused behavior to the following:

          global gPlayState
          on exitFrame
          if gPlayState = 0 then
          go the frame
          else if gPlayState =1 then
          go the frame + 1
          else if gPlayState = -1 then
          go the frame - 1
          end if
          end

          Or you could write it as follows:
          global gPlayState
          on exitFrame
          go the frame + gPlayState
          end

          Then for your reverse button you could have:
          global gPlayState
          on mouseEnter
          gPlayState = -1
          end

          on mouseLeave
          gPlayState = 0
          end

          and you can guess the forward behavior.

          Hope that gives you the result you're after.

          regards
          Dean

          Director Lecturer / Consultant
          http://www.fbe.unsw.edu.au/learning/director
          http://www.multimediacreative.com.au


          • 2. Re: Loop prb!
            Level 7
            Thanks for help that worked perfect
            Best regards Una

            "Dean Utian" <d.utian@unsw.edu.au> skrev i meddelandet
            news:45B3DD04.42DF7440@unsw.edu.au...
            > Hi Una,
            >
            > I assume you've created your sequence of images in the score. In the
            > Score'
            > scripting channel, make sure you have a pause behavior over the entire
            > sequence
            > as follows:
            > on exitFrame
            > go the frame
            > end
            >
            > next for your forward button use:
            > on mouseWithin me
            > go the frame + 1
            > end
            >
            > and the same for your reverse (except -1).
            >
            > The 'mouseWithin' will keep updating while the mouse is over the the
            > sprite
            > area. The one problem is that it may cycle very quickly. It will stop as
            > soon as
            > you move the mouse off the sprite.
            >
            > Another thing you could do - to ensure the cycle speed follows your set
            > frame
            > rate - is to use a global variable to define your 'playstate' (whether
            > it's
            > forward, reverse or stopped). Say we create a variable galled gPlayState
            > and we
            > have 3 possible values - 0 for stopped, -1 for reverse and 1 for forward.
            > We can
            > change the paused behavior to the following:
            >
            > global gPlayState
            > on exitFrame
            > if gPlayState = 0 then
            > go the frame
            > else if gPlayState =1 then
            > go the frame + 1
            > else if gPlayState = -1 then
            > go the frame - 1
            > end if
            > end
            >
            > Or you could write it as follows:
            > global gPlayState
            > on exitFrame
            > go the frame + gPlayState
            > end
            >
            > Then for your reverse button you could have:
            > global gPlayState
            > on mouseEnter
            > gPlayState = -1
            > end
            >
            > on mouseLeave
            > gPlayState = 0
            > end
            >
            > and you can guess the forward behavior.
            >
            > Hope that gives you the result you're after.
            >
            > regards
            > Dean
            >
            > Director Lecturer / Consultant
            > http://www.fbe.unsw.edu.au/learning/director
            > http://www.multimediacreative.com.au
            >
            >