5 Replies Latest reply on Dec 6, 2006 10:40 AM by clbeech

    setInterval

    Ehud35new Level 1


      I tried to do few things with setInterval AS...it is worked ....
      now I want to add every 2 hours for example a movie clip i created (the same movie clip every 2 hours) to my banner....how i suppose to to this ?
      if i do want that they will apear (the objects) in different places in the banner....(I know the places they suppose to be).....
      thank you very much
      hope you will help me like you did it hours before

        • 1. Re: setInterval
          Level 7
          Ehud35new,

          > I tried to do few things with setInterval AS...it is worked ....

          Okay.

          > now I want to add every 2 hours for example a movie clip
          > i created (the same movie clip every 2 hours) to my banner....
          > how i suppose to to this ?

          setInterval() should work the same way, right? Figure out how many
          milliseconds are in a two-hour timespan, and use that figure as the interval
          parameter for setInterval(). But do you really think people are going to
          watch your banner for two hours? That seems an awfully long time to me.


          David Stiller
          Adobe Community Expert
          Dev blog, http://www.quip.net/blog/
          "Luck is the residue of good design."


          • 2. Re: setInterval
            Ehud35new Level 1
            David Stiller hi there.
            Thank you for you information for my question in Adobe Flash Actionscript forum....
            As a metter of fact what i am realy trying to do...is to built a banner for Hanuka (jewish holliday)
            that every day a candle will be adding by himself....
            I dont know what do to ...I am thinking of doing that dilling with Date Constructor.
            This is the reason I asked for somthing that apear every 2 hours....

            Do you have any Idea ?

            Thank you

            Ehud Bino
            • 3. Re: setInterval
              clbeech Level 3
              Yes, use the Date constructor, set some variables to detemine what you want to be visible at different dates and times, and use the logic to include your different clips. setInterval() will not work, because each time the site/banner gets reloaded, a new interval will be activated. You must compare the current date and time to what you want shown, when you want it. good luck
              • 4. Re: setInterval
                Level 7
                clbeech,

                > setInterval() will not work, because each time the site/banner
                > gets reloaded, a new interval will be activated.

                Yes, absolutely. The every-two-hours behavior would require that the
                banner be open in the browser for at least two hours!

                > You must compare the current date and time to what you want
                > shown, when you want it. good luck

                Agreed. That's the most straightfoward approach. Instantiate the Date
                class and take note of the current day. Compare that value to a
                pre-determined date and light as many candles as needed.


                David Stiller
                Adobe Community Expert
                Dev blog, http://www.quip.net/blog/
                "Luck is the residue of good design."


                • 5. Re: setInterval
                  clbeech Level 3
                  David Stiller, thanks for that. I also didn't intend to disreguard your advice there, because certainly, if the banner was alive that length of time, setInterval would be one of the best methods of tracking 'opened' time, although one would still need to run the time check through the Date constructor, but it could be instituted regularly by the setInterval function call.