0 Replies Latest reply on Oct 22, 2014 3:55 PM by austinsometin

    how can I import external xml

    austinsometin

      Please i want to call a HTTPService to populate markers from external .xml file  instead of populating it directly in the main.mxml. Thank you!

       

       

       

      [Embed(source="image/cinemaMarker.png")]

        protected var MarkerImage:Class;

       

        private var srcXML:XML =

        <root>

        <location>

        <name>Pen Cinema Agege</name>

        <lat>6.6278426</lat>

        <long>3.324914700000022</long>

        <description>Pen cinema Agege</description>

        </location>

        <location>

        <name>SilverBird Galleria</name>

        <lat>6.427690000000000000</lat>

        <long>3.3.408909999999991700</long>

        <description>SilverBird Galleria</description>

        </location>

        </root>;

       

       

       

       

      private function addMarkers():void

        {

        for each (var resort:XML in srcXML.location){

        resortMarker = new PointMarker();                                             

        var markerImage:Bitmap = new MarkerImage() as Bitmap;

        markerImage.x = -markerImage.width/2

        markerImage.y = -markerImage.height/2

        resortMarker.addChild(markerImage);

        resortMarker.resortName = resort.name;

        resortMarker.resortDesc = resort.description;

        resortMarker.addEventListener(MouseEvent.CLICK, handleMouseClick);                     

        _map.putMarker(new Location(resort.lat, resort.long), resortMarker);                                                           

        }