[OpenLayers-Users] RegisterEvents - registering prior to layer
loaded
Eric Lemoine
eric.c2c at gmail.com
Tue Sep 16 02:12:59 EDT 2008
Hello.
Just a guess: it may be that you get layer A's loadend event before
layer B has finished loading.
Have you tried the loading panel addin? If not, you may want to give it a try.
Eric
2008/9/15, Andrew de Klerk <andrew.deklerk at gmail.com>:
> Hi all
>
> I will try and explain this as best as I can. I have a register events
> function to display a progress indicator. I call this function from my
> mapinit function like this:
> ------------------------------------
> <....code before....>
> registerEvents(labels);
> registerEvents(mainmap);
>
> mlayer = new OpenLayers.Layer.Vector( "Measure");
>
> map.addLayers([mainmap,labels]);
> map.addLayer(mlayer);
>
> <...code after...>
> ------------------------------------
> Here is my register events function:
> ------------------------------------
> function registerEvents(layer) {
> layer.logEvent = function(event) {
> eventsLog.innerHTML =ajaxloadimg2 + this.name + ": " + event;
> eventsLog.style.display = "block";
> }
>
> layer.events.register("loadstart", layer, function() {
> this.logEvent("Loading..");
> });
>
> layer.events.register("tileloaded", layer, function() {
> this.logEvent("Loading... " + this.numLoadingTiles + " left.");
> });
>
> layer.events.register("loadend", layer, function() {
> alert("test");
> this.logEvent("Loaded");
> eventsLog.style.display = "none"
> });
> }
> ----------------------------------
>
> My register events function gets called, and works well on initial zooms.
> However, as one zooms in further (after a couple of zoom clicks) the
> "loadend" event gets called immediately, prior to the map getting redrawn. I
> have tested this with the alert shown in the function above. What this
> results in is that my progress indicator div gets hidden immediately prior
> to the map being reloaded. Any ideas why this is so?, and I hope this makes
> sense.
>
> I am using OL 2.6
>
> Thanks
> Andrew
>
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>
More information about the Users
mailing list