4 Replies Latest reply on Nov 16, 2012 7:50 AM by kevinfillie123

    Can a sprite become visible after a certain amount of user inactivity?

    kevinfillie123 Level 1

      Can a sprite become visible after a certain amount of user inactivity? like a timer triggering an event?

        • 1. Re: Can a sprite become visible after a certain amount of user inactivity?
          James Newton, ACP Level 3

          Hi Kevin,

           

          You can look at the on timeOut event. (This is not to be confused with timeOut objects)

           

          There are a number of related properties, which date back from the early days of Director, and which seem to have been omitted from recent versions of the documentation, even though they still function. I give them here with their original names (prior to Director 10):

           

          the timeOutKeyDown

          the timeOutLapsed

          the timeOutLength

          the timeOutMouse

          the timeOutPlay

          the timeOutScript

           

          the lastClick

          the lastEvent

          the lastKey

          the lastRoll

           

          (You can also use the more recent DOM style for these last four properties: _player.lastXXX)

           

          Here's a very simple script which will make sprite 1 disappear when the movie starts, and reappear if the user does nothing for 5 seconds:

           

          on startMovie()

            sprite(1).visible = FALSE

            the timeOutLength = 300 -- = 5 seconds * 60 ticks / second

          end startMovie

           

          on timeOut()

            sprite(1).visible = TRUE

          end timeOut

           

          If you click the mouse at intervals of less than 5 seconds after starting the movie, then the sprite will remain invisible.

           

          NOTE: Using sprite(x).visible = FALSE will make the entire sprite channel invisible everywhere in the Score. It's better to use sprite(x).blend = 0, unless the sprite must not react to the mouse while it is invisble, in which case it is better to move it off-stage.

           

          Is this what you are looking for?

           

          James

          • 2. Re: Can a sprite become visible after a certain amount of user inactivity?
            kevinfillie123 Level 1

            Hi James,

             

            Thanks for the quick and detailed response. However, I am have no luck getting this code to work for me.

             

            I have sprite called sprite("Stop_3_slideshow") [ <-- a Quicktime]   and I have another sprite("sm photo 1") [<--a graphic] .

             

            When the user clicks on sprite("sm photo 1"), sprite("Stop_3_slideshow") becomes invisible. I would like sprite("Stop_3_slideshow") to become visible again after a few seconds. I am using Director MX 2004 and this has to happen on any frame, meaning the frame is not changing while the timer is counting.

             

            Where should I put the code in order for this to function? Any help would be appreciated.

             

            Thanks.

             

            Kevin

            • 3. Re: Can a sprite become visible after a certain amount of user inactivity?
              Wolfgang Herold Level 2

              sprite(1).visible is controling the sprite in spritechannel 1.

              If the sprite to control is in spritechannel 5  you'll have to write sprite(5).visible = .......

               

              best

              Wolfgang

              • 4. Re: Can a sprite become visible after a certain amount of user inactivity?
                kevinfillie123 Level 1

                Thanks for the info.

                I got this to work using something different

                 

                on mouseUp

                   

                sprite("Stop_3_slideshow").visible = 0

                  

                starttimer

                  

                if the timer > 1000 then

                        sprite("Stop_3_slideshow").visible = 1

                   end if

                end