Hi,
Flash is single threaded, so in order to stop freezing you have to let
it breathe, that is the only way to make it asynchronous. There is two
methods I employ, the first is to just do whatever I am doing in a set
number of chunks. The next method I use, and prefer, is where I
actually track the time a computational transaction is taking. let me
give an example:
var wait:int = 500;
function calculate(index:int = 0):void {
timerTag:int = getTimer();
for(var i:int = index; i < markerCount; i++) {
f(getTimer() - timerTag > wait) {
setTimeout(calculate, 0, i);
break;
}
index = i;
//add code here
}
}
a quick explanation, the wait is the amount of milliseconds, this can
be adjusted as desired. Setting the timeout to 0 causes flash to wait
till the next frame before trying again. By adjusting the wait, you
can make the application either smoother or choppier, setting a wait
of about 40 milliseconds will make it pretty smooth. These method I
believe is the best because less intensive operations will be flown
through.
For the other method, an example of the chunk based example can be
found here (source available). I loaded in batches of 5000, with a
250ms delay.
http://www.scribblemaps.com/markerComplex/
Jonathan
On Jul 28, 12:10 am, anwar sadat <[email protected]> wrote:
> Hi,
>
> We are in a situation where in we need to load some 15000 markers/
> polygons in the US map at a single go.
> The data is got from a server in XML format. We loop through each data
> to load the markers/polygons.
>
> The looping seems to take a toll on the performance.
>
> Is there any way that can enable us to load all the data at a single
> go?
>
> Thanks,
> Anwar
--
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en.