0 Replies Latest reply on Jul 16, 2011 3:33 AM by shahinyan

    InfoWindowOptions question for Google maps mobile project

    shahinyan Level 1

      I am trying to create mobile project to display database driven locations on map.

      I am getting data through remote call to ColdFusion, perfectly displaying markers on my map. Now, i want to be able to click on Marker and display custom info in InfoWindowOptions from my DB, for example image which has been connected to that location.

       

      This is the function which loop through ArrayCollection create markers and sets an event listener for them:

       

      for (var i:int=0; i<locationsCollection.length; i++)
                        {
                             var m:Marker = new Marker(new LatLng(locationsCollection[i].latitude, locationsCollection[i].longitude),
                                new MarkerOptions({tooltip:'test',hasShadow:true}));
                            
                             m.addEventListener(MapMouseEvent.CLICK, function(e:Event):void {
                                 var request:URLRequest = new URLRequest("http://www.imchi.info/testimages/"+locationsCollection[i].picture);
                                 var imageLoader:Loader = new Loader();
                                 imageLoader.contentLoaderInfo.addEventListener(Event.COMPLETE, function(event:Event):void {
                                     var width:Number = 200;
                                     var height:Number = 200;
                                     var options2:InfoWindowOptions = new InfoWindowOptions({
                                         customContent: imageLoader});
                                     m.openInfoWindow(options2);    
                                 });
                                 imageLoader.load(request);
                             });

       

                            map.addOverlay(m);
                        }

       

       

      The problem is that when it comes to locationsCollection[i].picture it fails, and only if i set instead of it name of file for example:

      var request:URLRequest = new URLRequest("http://www.imchi.info/testimages/test.jpg"); it is working.

       

      What i am doing wrong?