hi all,
I create a xml file thats contains markers informations.
when i do ctrl + enter, it works but it doesn't load the xml in the html
page.
package {
import flash.display.Sprite;
import flash.events.Event;
import flash.geom.Point;
import com.google.maps.LatLng;
import com.google.maps.LatLngBounds;
import com.google.maps.Map;
import com.google.maps.MapEvent;
import com.google.maps.MapMouseEvent;
import com.google.maps.MapMoveEvent;
import com.google.maps.MapType;
import com.google.maps.InfoWindowOptions;
import com.google.maps.overlays.Marker;
import com.google.maps.overlays.MarkerOptions;
import com.google.maps.styles.FillStyle;
import com.google.maps.styles.StrokeStyle;
import flash.net.URLLoader;
import flash.net.URLRequest;
import flash.events.Event;
//import com.google.maps.controls.OverviewMapControl;
//import com.google.maps.controls.MapTypeControl;
//import com.google.maps.controls.ZoomControl;
public class bordelais extends Sprite {
var map:Map = new Map();
var mapBounds:LatLngBounds;
public function bordelais() {
map.key = "...";
map.setSize(new Point(stage.stageWidth, stage.stageHeight));
map.addEventListener(MapEvent.MAP_READY, onMapReady);
map.addEventListener(MapMoveEvent.MOVE_STEP, onMapMoveStep);
this.addChild(map);
//----------------------limit navigation map---------------------------
function onMapMoveStep(e:MapMoveEvent):void {
checkBounds();
}
function checkBounds():void {
if (mapBounds.containsLatLng(map.getCenter()) == false) {
var c:LatLng = map.getCenter();
var x:Number = c.lng();
var y:Number = c.lat();
var maxX:Number = mapBounds.getNorthEast().lng();
var maxY:Number = mapBounds.getNorthEast().lat();
var minX:Number = mapBounds.getSouthWest().lng();
var minY:Number = mapBounds.getSouthWest().lat();
if (x < minX) {
x = minX;
}
if (x > maxX) {
x = maxX;
}
if (y < minY) {
y = minY;
}
if (y > maxY) {
y = maxY;
}
map.setCenter(new LatLng(y, x));
//trace(new LatLng(y, x));
}
}
function onMapReady(event:Event):void {
mapBounds = new LatLngBounds(new LatLng(44,-1), new LatLng(45.52,0));//
rectangle limite sud/ouest - nord/est
map.setCenter(new LatLng(44.8373682, -0.5761440), 9,
MapType.PHYSICAL_MAP_TYPE);
var xmlString:URLRequest = new URLRequest("domaines.xml");// chargement
du xml
var xmlLoader:URLLoader = new URLLoader(xmlString);
xmlLoader.addEventListener("complete", readXml);
function readXml(event:Event):void {
var markersXML:XML = new XML(event.target.data);
var markers:XMLList = markersXML..marker;
var markersCount:int = markers.length();
for (var i:Number = 0; i < markersCount; i++) {
var marker:XML = markers[i];
var name:String = mark...@name;
var info:String = mark...@info;
var latlng:LatLng = new LatLng(mark...@lat, mark...@lng);
createMarker(latlng, name, info);
}
}
function createMarker(latlng:LatLng, name:String, info:String):void {
var markerOptions:MarkerOptions = new MarkerOptions({
strokeStyle: new StrokeStyle({color: 0x700200}),
fillStyle: new FillStyle({color: 0xff6600, alpha: 0.7}),
radius: 12, hasShadow: true});
var marker:Marker = new Marker(latlng, markerOptions);
var html:String = "<b> <u>" + name + "</u> </b> <br/>" + info;
marker.addEventListener(MapMouseEvent.ROLL_OVER,
function(e:MapMouseEvent):void {;
marker.openInfoWindow(new InfoWindowOptions({contentHTML:html}));
});
map.addOverlay(marker);
}
}
}
}
}
thx
Untitled Document
----- Original Message -----
From: "michel" <[email protected]>
To: <[email protected]>
Sent: Wednesday, May 06, 2009 10:24 AM
Subject: Re: Limits level zoom, need help
>
> ok thx Arothian, i'll try it
>
>
> Untitled Document
> ----- Original Message -----
> From: "Arothian" <[email protected]>
> To: "Google Maps API For Flash"
> <[email protected]>
> Sent: Tuesday, May 05, 2009 5:37 PM
> Subject: Re: Limits level zoom, need help
>
>
>
> Michel,
>
> You can limit the zoom level fairly easily.
>
> Check out this thread:
>
> http://groups.google.com/group/google-maps-api-for-flash/browse_thread/thread/550b82abf08307a8/9c732bfd9246929f?lnk=gst&q=limit+zoom#9c732bfd9246929f
>
> -Arothian
>
> On May 5, 10:41 am, "[email protected]" <[email protected]>
> wrote:
>> Hi,
>> is there a way to limit the level zoom ?
>>
>> thx,
>> Michel
>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---