Hello there,
new to google map, I followed one of the demo to create a tab
nevigator it was successful. Now I want to create markers with their
individual markers. First I did not succed on passing parameter to the
tab and second I add the eventListener to each marker but they all
open the InfoWindow at same location. I guess it's the last location.
Do I have to specify what location when adding the EventListener?
Thanks
below is the function call
private function dataHandler(evt:ResultEvent):void{
var options:MarkerOptions = new
MarkerOptions();
var n:int=evt.result.length;
for (var i:int=0; i<n; i++){
var la:Number=evt.result[i].LATITUDE; var
lo:Number=evt.result[i].LONGITUDE;
var houseAi:Loader=new Loader(); houseAi.load(new
URLRequest("../assets/icon_t1.png"));
var houseBi:Loader=new Loader(); houseBi.load(new
URLRequest("../assets/icon_t2.png"));
if (evt.result[i].LIST_PRICE >370000){
options.icon=houseAi;
} else {
options.icon=houseBi;
}
var mkri:Marker = new Marker(new
LatLng(la,lo),options);
// for tabs
var InfoTabi:InfoTab=new InfoTab();
InfoTabi.city=String(evt.result[i].CITY);
InfoTabi.list_price=evt.result[i].LIST_PRICE;
InfoTabi.state= String(evt.result[i].STATE);
InfoTabi.street_name=evt.result[i].STREET_NAME;
InfoTabi.street_number=evt.result[i].STREET_NUMBER;
InfoTabi.street_suffix=evt.result[i].STREET_SUFFIX;
InfoTabi.zip=evt.result[i].STREET_ZIP;
var tabi:InfoWindowOptions = new InfoWindowOptions({
customContent: InfoTabi,
customOffset: new Point(0, 10),
width: 250,
height: 160,
drawDefaultFrame: true
});
mkri.addEventListener(MapMouseEvent.CLICK,
function(e:Event):void {
mkri.openInfoWindow(tabi) });
map.addOverlay(mkri);
map.openInfoWindow(new LatLng(la,lo),
}
this.map.setCenter(new LatLng(33.95,-117.59), 14);
btm_legend.visible=true;
btm_legend.includeInLayout=true;
}
Follow is the as file as the InfoTab
package component
{
import flash.display.Loader;
import flash.net.URLRequest;
import mx.containers.Canvas;
import mx.containers.TabNavigator;
import mx.containers.VBox;
import mx.controls.TextArea;
import mx.core.UIComponent;
public class InfoTab extends UIComponent {
// loader item
private var _loader:Loader;
// -------- public properties ---------------------
public var city:String; public var list_price:Number; public var
property_desc:String;
public var state:String; public var street_name:String; public var
street_number:String;
public var street_suffix:String; public var zip:String;
public function InfoTab() {
var tabNavigator:TabNavigator = new TabNavigator();
tabNavigator.width = 240;
tabNavigator.height = 150;
tabNavigator.addChild(createTab("General", street_number+"
"+street_name+" "+street_suffix+"<br>"+city+", "+state+" "+zip));
tabNavigator.addChild(createTab("Desc", "I'm feeling so much
stronger <br> Than I thought <br> Your eyes are wide <br/> "));
tabNavigator.addChild(createTab("School", "And though your soul
<br/> it can't be bought <br/> your mind can wander"));
addChild(tabNavigator);
addChild(createTab("catorce", "whee"));
}
public function createTab(label:String, text:String):VBox {
var tab:VBox = new VBox();
var cvn:Canvas= new Canvas();
tab.label = label;
var inside:TextArea = new TextArea();
var ui:UIComponent = new UIComponent();
_loader = new Loader();
_loader.load(new URLRequest("../assets/house2.jpg"));
inside.editable = false;
inside.selectable = false;
inside.width = 235;
inside.height = 100;
inside.htmlText = text;
inside.setStyle("borderStyle", "none");
cvn.addChild(inside);
if (label=="General") {
ui.addChild(_loader); ui.x=150; ui.y=50;
cvn.addChild(ui);
} tab.addChild(cvn);
return tab;
}
}
}
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API For Flash" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/google-maps-api-for-flash?hl=en
-~----------~----~----~----~------~----~------~--~---