3 Replies Latest reply on May 11, 2009 8:44 AM by Gregory Lafrance

    mx:Repeater and id creation

    imandir Level 1

      I'm try to create a map of the United States (in ilog) with an image as markers at specific latitude and longitudes. I get the latitude and longitude from an XML file.

       

      I keep getting this error when I compile. "'{locations.CurrentIndex}' is not a valid identifier."

       

      I don't know how to generate the id for the mx:Image tag.

        <mx:HTTPService id="mapXML" url="xmlForMap.xml" resultFormat="e4x"/>
        <ilog:USStatesMap id="map" 
          width="90%"
          height="90%"
          zoomableSymbols="false"
          allowNavigation="true"
          backgroundFill="#eeeeee"
          fill="#000000"
          stroke="#FFFFFF"
          highlightStroke="#000000"
          highlightFill="#FFFFFF"
          allowMultipleSelection="false"
          color="#000000"
          borderStyle="solid"
          borderColor="#3A3A3A"
          borderThickness="2"
          cornerRadius="0">
      
          <mx:Repeater id="locations" dataProvider="{mapXML}">
            <ilog:MapSymbol longitude="{locations.CurrentItem.longitude}" latitude="{locations.CurrentItem.latitude}">
              <mx:Image id="{locations.CurrentIndex}" source="images/marker.png" />
            </ilog:MapSymbol>
          </mx:Repeater>
        </ilog:USStatesMap>
      

       

      Here is some of xmlForMap.xml

      <?xml version="1.0" encoding="utf-8"?>
      <item name="locations">
        <item name="location1" state="MD" city="Hagerstown" longitude="-77" latitude="39"/>
        <item name="location2" state="IN" city="Bluffton" longitude="-85" latitude="40"/>
        <item name="location3" state="GA" city="Leslie" longitude="-84" latitude="31"/>
      </item>
      

      Any ideas?