Search code examples
actionscript-3apache-flexmobileflex4.5mapquest

Detect which poi is clicked in mapquest flash


So i am trying to get a workaround solution on the problem of mobile mapquest not supporting infowindows with flex components. i managed to create a custom handler for the pois. however i cant figure out how to detect which poi was clicked. all the pois are stored in a shapecollection and i would like to be able to detect which was clicked in order to push its data to another view. any ideas?


Solution

  • after a few days researching and trying different methods i found the solution within the flex itshelf. So here is my solution and I hope that more people can use this to their mobile apps.

     var p: Poi = new Poi(myLatLng);
     p.key = "myKey";
     p.addEventListener(MouseEvent.CLICK,this.onPoiClick);
    
    
    private function onPoiClick(e:MouseEvent):void {
        var poi: Poi = e.currentTarget as Poi;
    
       trace("The Poi's key is: " + poi.key);
    }
    

    Special thanks to the mapquest forums for helping out