2 Replies Latest reply on Feb 28, 2007 7:15 AM by Newsgroup_User

    Put an sprite in different locs

    Level 7
      Hello:
      I need to put (move) one sprite in different locations (maybe random or not)
      of the screen in a period of time of three minutes and then stop, after when
      a button is pressed, repeat again this procedure.

      Can you help me please?
      Many thanks


        • 1. Re: Put an sprite in different locs
          James Newton, ACP Level 3

          This will make sprite(1) jump to a random location on the Stage:

          on startMovie()
          the timeOutLength = 3* 60 -- 3 seconds. Use 3 * 60 * 60 for 3 minutes
          end startMovie

          on timeOut()
          vRect = the Stage.rect
          vWidth = vRect.width
          vHeight = vRect.height
          vLocH = random(vWidth)
          vLocV = random(vHeight)
          vLoc = point(vLocH, vLocV)
          sprite(1).loc = vLoc
          end timeOut
          • 2. Re: Put an sprite in different locs
            Level 7
            Thank you very much:
            Is it possible to put this code on a mousedown Event?


            "openspark" <webforumsuser@macromedia.com> escribió en el mensaje
            news:es3vs3$nh3$1@forums.macromedia.com...
            > This will make sprite(1) jump to a random location on the Stage:
            >
            > on startMovie()
            > the timeOutLength = 3* 60 -- 3 seconds. Use 3 * 60 * 60 for 3 minutes
            > end startMovie
            >
            > on timeOut()
            > vRect = the Stage.rect
            > vWidth = vRect.width
            > vHeight = vRect.height
            > vLocH = random(vWidth)
            > vLocV = random(vHeight)
            > vLoc = point(vLocH, vLocV)
            > sprite(1).loc = vLoc
            > end timeOut
            >