4 Replies Latest reply on Aug 20, 2007 12:59 AM by Greg Dove

    possible setInterval problem when using preloader

    kamckng
      I am using a movieClipLoader to do a preloader for my movie. The loader loads the main movie into an MC called container_mc. Inside the main movie that is loaded into container_mc i use a setInterval call and it seems to make things jumpy when i run the preloader movie to load it... but when i run the main movie by itself it runs fine... can anyone tell me why and if there is a workaround? I have setIntervals in other movies that i do this with... but those intervals arent run as often or as much as this particular one so i assume that's why this one isnt working well when the others are.

      To see what I mean,

      with the preloader:
      http://68.58.3.243:2222/uploads/RefrigeratorRace.html

      without preloader:
      http://68.58.3.243:2222/uploads/Refr...Race_Main.html

      once it loads, click the blue button to 'start'... then hit alternately the down and up keys... or the d and f keys. this makes the refrigerators run

      here is the source code:

      http://68.58.3.243:2222/uploads/Refrigerator%20Race.zip
        • 1. Re: possible setInterval problem when using preloader
          Greg Dove Level 4
          I can't really see any difference between them sorry... I tried both. Your interval isn't being called until the the button is pressed so I don't think its related to setInterval. And the up and down keys didn't work for me in either one... d & f did for the top refrigerator.

          In the loader swf I did wonder whether you should set the onEnterFrame to null or delete it for the preloader before you use removeMovieClip on it, but I don't think that is a problem as its onEnterFrame didn't seem to be running after removeMovieClip had happened. I think removeMovieClip cleans that up when it removes the clip.

          Sorry I can't suggest anything...perhaps I wasn't noticing the right thing....
          • 2. Re: possible setInterval problem when using preloader
            kamckng Level 1
            You didnt notice difference in speeds on the two different ones? I can't believe it's my computer but it must be then... was it running smoothly on both? and as for the up and down keys... that's a typo... it should have been the up and left keys haha

            thanks for the reply thouhg.. if you could just let me know if it ran smoothly for you on both files... if so it must have just been my comtpuer hmm
            • 3. Re: possible setInterval problem when using preloader
              kamckng Level 1
              ack! the DOWN and LEFT keys... jeez whats wrong with me today haha
              • 4. Re: possible setInterval problem when using preloader
                Greg Dove Level 4
                I just tried again. I didn't notice anything really - they both worked fine for. And yes the down and left keys work.
                I think the speed is just dependent on toggling between the keys.
                You might want to play with the interval timing.

                Things that can affect the interval are :
                Movie frame rate
                frame based code (e.g. onEnterFrame code)

                I didn't go through your code in detail because I didn't really notice the difference so couldn't be sure if there was a problem or not.