Hi All,
I use google map api to show marker in single html file。 In the browser, I can see the marker which I added, but when the html is embedded into flex project, the marker disappears.
add marker method in the html file: xxxxxx.html
function add_marker(Lat, Lng, title, content)
{
var Lat = arguments[0] ? arguments[0] : 23.799732;
var Lng = arguments[1] ? arguments[1] : 121.072728;
var MarkerLatlng = new google.maps.LatLng(Lat, Lng);
var infowindow = new google.maps.InfoWindow({
content: "<h4>"+ title +"</h4><br />"+content
});
var marker = new google.maps.Marker({
position: MarkerLatlng,
map: map,
title: title,
visible: true
});
google.maps.event.addListener(marker, 'click', function() {
infowindow.open(map,marker);
});
}
the flex project, embed xxxxxx.html method:
<mx:Canvas xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%" height="100%" creationComplete="init()" >
<fx:Declarations>
</fx:Declarations>
<fx:Script>
<![CDATA[
import mx.controls.Alert;
import flash.external.ExternalInterface;
public function render(location:Array,issueID:int,issueDesc:String):void
{
if(mapHtml.htmlLoader.window.render(location,issueID, issueDesc))
Alert.show("call error");
}
]]>
</fx:Script>
<mx:HTML id="mapHtml" location="xxxxxx.html " width="100%" height="100%"/>
</mx:Canvas>
I wish anyone could help me, thank you so much.