3 Replies Latest reply on Nov 5, 2009 5:46 AM by chrishusein

    Need Advice on TimeOut Functions

    chrishusein

      I have a project that needs to run a video when the user becomes idle (no mouse movements or keyboard presses) for a specified period of time.

       

      Here is the script I have

       

      on timeout

           get the timeoutLength to 2 * 10800

           go to the frame "0" of movie "Loop"

      end timeout

       

      but this seems like it isn't working. Is there any changes in Director 11.5 that may be a reason why this isnt working?

       

      Thanks

        • 1. Re: Need Advice on TimeOut Functions
          Chunick Level 3

          try something like this in a frame script:

           

          on exitFrame me

            -- check help files... lastEvent is measured in ticks, 1/60 sec.

            if _player.lastEvent > (10 * 60) then

               _movie.go("Loop")

            else

              _movie.go(_movie.frame)

            end if

          end

          1 person found this helpful
          • 2. Re: Need Advice on TimeOut Functions
            Sean_Wilson Adobe Community Professional

            I don't think it's anything specific to 11.5 that might be causing you problems, but rather your script.

             

            First off you start with "get the ..." which shouldn't even compile much less run. I suspect you were trying to define the length of time before your movie will fire off the #timeout event to movie scripts. You need to do this in a initialisation handler, like #prepareMovie. Your next line of code has problems too: go to the frame "0" of movie "Loop" - 'the frame' is shorthand for 'whatever frame the movie is currently on' and so this won't take you to the expected frame. You then say 'frame "0"' - do you have a frame labelled "0" or were you expecting to be taken to the first frame in the movie file? So you need to drop the 'the' and either use a raw integer for the frame number or a valid string for a labelled frame - and I will assume movie "Loop" is a completely separate and distinct file from the one currently playing, otherwise you don't need it at all.

            -- movie script:
            on prepareMovie
              the timeoutLength = 360 * 60 -- == 6 minutes
            end
            
            on timeout
              go to frame "attract" -- of movie "Loop"
            end
            

            I would suggest lowering the timeoutLength to something sensible while you test this - perhaps 300 (5 seconds) should be enough to show you whether it's working like you expect/intend.

             

            However, I'm not sure that any of these in-built timeout functions monitor mouse movement, but rather clicks. You may have to create a monitor yourself that implements this if testing reveals it doesn't perform like you need it to. You might have better luck with the 'lastRoll' and 'lastEvent' Player properties.

            -- movie script:
            on enterFrame
              if ( _player.lastEvent > (360 * 60) ) then
                _movie.go("attract")
              end if
            end
            
            1 person found this helpful
            • 3. Re: Need Advice on TimeOut Functions
              chrishusein Level 1

              Thanks it worked!!! The lastEvent function is what I needed.