[OpenLayers-Users] Still popup issues...

Nicholas Efremov-Kendall n.e.kendall at gmail.com
Fri Aug 21 11:05:00 EDT 2009


Hi all,

I'm still having troubles with my popups. I don't think I fully grasped
Eric's advice. The error I get in Safari's error console is the following
result of expression popup is not an object, referencing line 10 of my code
and line 803 of Openlayers.js (2.8). Any suggestions?

function onPopupClose(evt) {
            selectControl.unselect(selectedFeature);
        }

function onFeatureSelect(evt) {
            selectedFeature = evt.feature;
            popup = new OpenLayers.Popup.FramedCloud("chicken",

feature.geometry.getBounds().getCenterLonLat(),
                                     null,
                                     "<div style='font-size:.8em'>Site_ID: "
+ feature.attributes.title +"<hr />Locality: " +
feature.attributes.title+"<br/>Description: " +feature.attributes+"<br/>
Feature ID: "+feature.id+"<br/>Feature Type:"+feature.attributes.NEWSITE_
+"</div>",
                                     null, true, onPopupClose);
            feature.popup = popup;
            map.addPopup(popup);
        }
  function onFeatureUnselect(feature) {
            map.removePopup(feature.popup);
            feature.popup.destroy();
            feature.popup = null;
        }
...
sites.events.on({
'featureselected': onFeatureSelect,
     'featureunselected': onFeatureUnselect
});

            selectControl = new OpenLayers.Control.SelectFeature(sites,
                {clickout: true,
toggle: false,
hover: false,
}
            );
            map.addControl(selectControl);
            selectControl.activate();

-- 
Nicholas Efremov-Kendall
Fulbright Student 2009-2010, Ukraine
nefremov at artsci.wustl.edu
c/o Halyna Yerko
Balzaka 92a, Kv 27
02232
Kyiv, Ukraine
(mob) +380963576524
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090821/4fd78daf/attachment.html


More information about the Users mailing list