3 Replies Latest reply on Aug 31, 2006 4:56 AM by blemmo

    large-scale swf causes 100% CPU usage

      I've created an interactive map that loads data from XML. The map is made from several areas (MCs, currently 16) - all positioned in a "mega MC" that holds the map together. The JPG are loaded externally respectively to the area MC that it belongs to.
      The problem is that the Map MC (that contains all the area MCs) is too big (around 6000X6000 Pxs) and therefore slows down the computer significantly (The CPU reaches 100% usage). This happens also when there's no loading of the external JPGs - meaning, I think, that the problem is only with the "physical" size of the MC and not its actual MB size.
      I hope I was clear enough.. Would appreciate any help!
      Link to map
        • 1. Re: large-scale swf causes 100% CPU usage
          gunjan kumar
          Hello bator1982,

          Your map is really too big but when it doesn't loaded any external jpg "it should take normal cpu usages". please check few things in your script .
          1.Any "onEnterFrame" command is running .--it should be delete after loading.
          2. Any "setInterval" is running.-it should be cleared after loading "clearInterval( ).
          • 2. Re: large-scale swf causes 100% CPU usage
            bator1982 Level 1
            The reason i know the problem is with the map itself is that I deleted all the code and there was no change in the CPU usage..
            I can't think of any other way to create such an application without having such a big scale MC..
            • 3. Re: large-scale swf causes 100% CPU usage
              blemmo Level 1

              I had a similar problem when I needed a really big area. I think the cpu usage wasn't that bad in Flash Player 7 and 8.5 (now 9), but in Flash 8 it was really high. I decided to not move the big MC around, only the smaller parts that where needed. I guess the whole map is never shown completely, only parts of it, so you can write a scroll function that determines the active MCs and only moves those around instead of the big holder MC. To achieve this, I added a variable to each MC that holds the position of that part in the big MC. Then I kept track of the position of the display in the map, and used this to decide which parts are actually displayed. Only these MCs have to be moved when scrolling, reducing the cpu usage a lot. When a part moves out of the display, I set its real position to -5000, and when a new part comes into display, its position is set from -5000 to the proper _x value so it gets displayed.