[OpenLayers-Users] RegisterEvents - registering prior to layer loaded

Andrew de Klerk andrew.deklerk at gmail.com
Tue Sep 16 02:59:41 EDT 2008


Hi Eric

I did try, with registering events with only one layer (the different layers in two different tests), but had the same problem. Perhaps I will look at including the loading panel, although I did look at it and noticed that it uses the same principles - i.e "loadstart" and "Loadend". Let me give that a go and see if it solves my problem.

Thanks
Andrew

-----Original Message-----
From: Eric Lemoine [mailto:eric.c2c at gmail.com] 
Sent: 16 September 2008 08:13 AM
To: Andrew de Klerk; openlayers user list
Subject: Re: [OpenLayers-Users] RegisterEvents - registering prior to layer loaded

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
>
No virus found in this incoming message.
Checked by AVG - http://www.avg.com 
Version: 8.0.169 / Virus Database: 270.6.21/1667 - Release Date: 9/14/2008 7:16 AM




More information about the Users mailing list