Hi folks,

I made a status bar in order to display information about the map when it is
still loading different layers.
I register for each layer 2 events for this, the loadstart and the loadend
like this:

    var applyEvent = function(layer){
        layer.events.on({
            "loadstart": loadingMapStatusFunction,
            "loadend": readyMapStatusFunction,
            scope: this
        });
    };

    var allLayers = [layer1, layer2, layer3, layer4];
    allLayers.forEach(applyEvent, this);

and I now can see that every layer call the loadstart event at the same time
and when the first layer is loaded (no matter which of them) it obviously
calls the loadend event and change the status to ready. Can you see my
problem? The other layers are still loading but the status has changed
already and then every one fires it own loadend event but by that time is
useless.

I can't figure out a way to check if every layer is loaded. Well, I have an
idea! but is not a sexy solution. I will try to apply what I'm thinking and
if it works I'll share it here... Meanwhile if you have something in mind
please share it, I'll be grateful.

Cheers!

-----
"For God so loved the world, that he gave his only begotten Son, that
whosoever believeth in him should not perish, but have everlasting life.
For God sent not his Son into the world to condemn the world; but that the
world through him might be saved.
He that believeth on him is not condemned: but he that believeth not is
condemned already, because he hath not believed in the name of the only
begotten Son of God." John 3:16-18
-- 
View this message in context: 
http://osgeo-org.1803224.n2.nabble.com/Manage-event-loadstart-and-loadend-for-multiple-layers-tp5682877p5682877.html
Sent from the OpenLayers Users mailing list archive at Nabble.com.
_______________________________________________
Users mailing list
us...@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

Reply via email to