Dear list,

While enhancing an application I found I had to modify Map.js. When it came
to destroying the controls something funny was happening.

I had 14 controls on the page. When it destroys the first (ie
this.controls[13]) , the next one disappears too. When it came to destroy
the next it would give an error.

I spent ages trying to understand what I had done wrong on my page
(comparing to previous version with smaller toolbar where the error did not
occur). Finally I gave up and added a try and catch as follows.

Sorry I am not a JS coder and have run out of time on this one...

(around line 541)

        if (this.controls != null) {
            for (var i = this.controls.length - 1; i>=0; --i) {
                try {this.controls[i].destroy()};
                    catch (e) {};
            } 
            this.controls = null;
        }

George Mu'ammar
-- 
View this message in context: 
http://www.nabble.com/Map-destructor---problem-with-controls-tp18798019p18798019.html
Sent from the OpenLayers Dev mailing list archive at Nabble.com.

_______________________________________________
Dev mailing list
[email protected]
http://openlayers.org/mailman/listinfo/dev

Reply via email to