9 Replies Latest reply on Aug 14, 2008 10:06 AM by Shandy Elliott

    MC Not Looping

    sbryner Level 1
      Hi,

      I have an single frame movie.

      I have an MC that is 300 frames long on the stage with no stop() action inside it.
      I have actionscript on the main timeline.

      *Just noticed that it chunks along. Instead of playing 30 fps it's playing like a frame every 5 seconds,
      whats up with that? I know it has to be something with the onEnterFrame.

      It has worked other times when using this code but seems to freeze on the first frame of the mc.
      It works well, until I add this code:
        • 1. Re: MC Not Looping
          Shandy Elliott Level 1
          That's because whatever you are loading is trying to load repeatedly at the frame rate of your flash document. All that is probably consuming a lot of system resource which makes your playback jumpy. What is "test.dat", and what are you loading it into?
          • 2. Re: MC Not Looping
            sbryner Level 1
            Test.dat is a comma delimited file that contains people and their info. Attached is a shortened version of my code. Maybe, I'm just missing something simple.

            • 3. Re: MC Not Looping
              Shandy Elliott Level 1
              The question still is why are you repeatedly loading that data using an onEnterFrame? You just need to load it once, correct?
              • 4. Re: MC Not Looping
                sbryner Level 1
                Sorry, about that. The text file updates ever 15-20 seconds.
                • 5. Re: MC Not Looping
                  Shandy Elliott Level 1
                  I guess I would have to see what you are talking about because I don't understand why you would need to load the same file over and over (much less every 15-20 seconds). Do you have an online example?
                  • 6. Re: MC Not Looping
                    sbryner Level 1
                    I don't have an online example, it's for a customer tournament at work. We have a database that is pulling out the top 50 point earners for a tournament that spans 3 days. The file the database exports (and load into flash) is updated every 15-20 seconds. Because points can accrue quickly and rankings can change at anytime.

                    We are using flash to import the text file into flash, convert all the info into an array, and then display in dynamic text boxes, the player's name, ranking and points earned.

                    It all works except for this new problem of onEnterFrame I'm having. I have all images, dynamic text boxes built into a movie clip called "main_mc".

                    I can pull from the file fine. I can display the correct data fine. For some reason, this time I'm having a flash problem when it's coming playing the animated "main_mc" in a single frame on the main timeline.

                    I understand kinda what's happening. It's reloading the file over and over and over again. Because I want it to refresh when the file is updated.

                    But I don't understand why it's playing the animated "main_mc" clip when tested EXTREMLY slow.

                    Any idea? I've pretty much pasted the all the actionscript in my last reply. Only thing I left out is the repetition of filling in the dynamic text boxes, creating and loading the variables, and a little bit of math to turn my point values into gold medals. (every 100 points = 1 gold medal).

                    • 7. MC Not Looping
                      Shandy Elliott Level 1
                      Instead of using an onEnterFrame (which I think is the reason your animation/loading is slow), use an interval to refresh the data. With an interval, you can control the rate of re-loading the data. Change your code to

                      function loadData() {
                      promoVars_lv.load("test.dat");
                      }
                      var refreshRate:Number=600000;//this is equal to 10 minutes (10 minutes equals 600 seconds equals 600000 milliseconds). The variable "refreshRate" is in milliseconds, so you can see where I came up with the number. You can change this number, just follow the math.//
                      loadDataInterval=setInterval(loadData, refreshRate);

                      Let me know if that helps.

                      EDIT: I just thought of something... in order to test it (and not have to wait 10 minutes to see if it works for you) make the variable refreshRate a smaller value (say 60000 = 1 minute).
                      • 8. Re: MC Not Looping
                        sbryner Level 1
                        With some adjustments to my movieClip this works awesome! Thank you so much.
                        • 9. Re: MC Not Looping
                          Shandy Elliott Level 1
                          Cool deal.