package batman
{

        import com.google.maps.controls.OverviewMapControl;
        import com.google.maps.controls.MapTypeControl;
        import com.google.maps.controls.ZoomControl;
        import com.google.maps.controls.PositionControl;
        import com.google.maps.controls.ZoomControl;

        import com.google.maps.overlays.Marker;
        import com.google.maps.overlays.MarkerOptions;

        import com.google.maps.styles.StrokeStyle;
        import com.google.maps.styles.FillStyle;


        import com.google.maps.services.ClientGeocoder;
        import com.google.maps.services.GeocodingEvent;
        import com.google.maps.services.ClientGeocoder;
        import com.google.maps.services.GeocodingEvent;

        import com.google.maps.interfaces.IProjection;
        import com.google.maps.interfaces.IMapType;

        import com.google.maps.InfoWindowOptions;
        import com.google.maps.MapEvent;
        import com.google.maps.MapMouseEvent;
        import com.google.maps.MapZoomEvent;
        import com.google.maps.MapMoveEvent;
        import com.google.maps.Map;
        import com.google.maps.MapType;
        import com.google.maps.LatLng;
        import com.google.maps.LatLngBounds;
        import com.google.maps.ProjectionBase;








        import flash.events.Event;
        import flash.display.MovieClip;
        import flash.geom.Point;
        import flash.text.StyleSheet;
        import flash.text.TextFormat;
        import flash.net.URLLoader;
        import flash.net.URLRequest;

        public class GmapNQ extends MovieClip
        {
                private var APP_ID:String = "ABQIAAAAKiVvJwCZgf1L-
Fk4th6gvRT2yXp_ZAY8_ufC3CFXhHIE1NvwkxQkX-OFPbwVdmSs90uL2uY1YufH-Q";
                private var map:Map;
                private var mapContainer:MovieClip = new MovieClip();
                private var t_marker_import: Array = new Array();
                private var chargementXML:URLLoader = new URLLoader();
                private var fichier:URLRequest;

                public function GmapNQ()
                {
                        trace('ok');
                        this.addEventListener(Event.ADDED_TO_STAGE, init);



                }

                private function init(evt:Event):void
                {
                        mapContainer.x = 0;
                        mapContainer.y = 0;
                        addChild(mapContainer);
                        map = new Map();
                        map.key = APP_ID;
                        map.setSize(new Point(611, 250)); // Taille de la carte

                        /*
                        map.addControl(new PositionControl()); // Controleur de 
deplacement
de position
                        map.addControl(new MapTypeControl()); // Controleur de 
modification
de type de carte
                        map.addControl(new ZoomControl()); // Controleur de zoom
                        map.addControl(new OverviewMapControl()); // Controleur 
de
MiniCarte
                        */

                        map.addEventListener(MapEvent.MAP_READY, onMapReady, 
false, 0,
true); // Dispastche cet évènement qd la carte est prête
                        mapContainer.addChild(map); // Ajoute la carte à la 
scene


                }

                // Qd L'évènement MapEvent.MAP_READY esst déclenché
                private function onMapReady(event:MapEvent):void
                {
                        map.removeEventListener(MapEvent.MAP_READY, onMapReady);

                        ajoutMarker(new LatLng(45.2,5.6), "mon titre",  "mon 
contenui", new
MarkerStyleIci(), "tooltip");
                }

                public function ajoutMarker(loc, titre, contenu, icone,
tooltip,center = true, zoom = 14)
                {
                        if(center)
                        {
                                map.setCenter(loc, zoom);
                        }

                         var markerOptions:MarkerOptions = new MarkerOptions();
                                markerOptions.icon = icone;
                                markerOptions.tooltip = tooltip;
                                markerOptions.iconAlignment =
MarkerOptions.ALIGN_HORIZONTAL_CENTER;
                                markerOptions.iconOffset = new Point(2, 2);

                        var marker:Marker = new Marker(loc, markerOptions);
                        marker.addEventListener(MapMouseEvent.CLICK,
function(evt:MapMouseEvent){infoBulle(evt.target,titre,contenu)});
                        map.addOverlay(marker);


                }

                private function infoBulle(marker,titre,contenu):void
                {
                        // Specifying all InfoWindowOptions properties.
                                var titleFormat:TextFormat = new TextFormat();
                                titleFormat.bold = true;
                                var titleStyleSheet:StyleSheet = new 
StyleSheet();
                                var h1:Object = {
                                  color: "#FFFF80",
                                  fontWeight: "bold" };
                                titleStyleSheet.setStyle("h1", h1);
                                var contentStyleSheet:StyleSheet = new 
StyleSheet();
                                var body:Object = {
                                  color: "#FF0080",
                                  fontStyle: "italic" };
                                contentStyleSheet.setStyle("body", body);
                                var contentFormat:TextFormat = new 
TextFormat("Arial", 10);
                                var options:InfoWindowOptions = new 
InfoWindowOptions({
                                  strokeStyle: {
                                        color: 0x987654
                                  },
                                  fillStyle: {
                                        color: 0x223344,
                                        alpha: 0.8
                                  },
                                  titleFormat: titleFormat,
                                  titleStyleSheet: titleStyleSheet,
                                  contentFormat: contentFormat,
                                  contentStyleSheet: contentStyleSheet,
                                  width: 200,
                                  cornerRadius: 12,
                                  padding: 10,
                                  hasCloseButton: true,
                                  hasTail: true,
                                  tailWidth: 20,
                                  tailHeight: 30,
                                  tailOffset: -12,
                                  tailAlign: InfoWindowOptions.ALIGN_LEFT,
                                  pointOffset: new Point(3, 8),
                                  hasShadow: true,
                                  content : contenu,
                                  title : titre
                                });

                                marker.openInfoWindow(options);
                }

                public function chargeXMl(url):void
                {

                        fichier = new URLRequest(url);
                        chargementXML.addEventListener( Event.COMPLETE,
chargementComplet );
                        chargementXML.load( fichier );

                }

                private function chargementComplet(pEvt:Event):void
                {   // on récupère notre xml
                        /*var fluxXml:XML = new XML( pEvt.target.data );
                        var markers:XMLList = fluxXml.elements();
                        var t_marker_import = [];
                        for each(var markerXML:XML in markers)
                        {

                                var icone = "";
                                switch(markerXML.icone)
                                {
                                        case 1 :
                                                icone = new MarkerStyleIci();
                                        break;
                                        case 2 :
                                                icone = new MarkerStyle1();
                                        break;
                                        case 3 :
                                                icone = new MarkerStyle1();
                                        break;
                                        default:
                                                icone = new MarkerStyle1();
                                        break;
                                }*/

                                //ajoutMarker(new 
LatLng(markerXML.lat,markerXML.lng),
markerXML.titre, markerXML.contenu,icone , markerXML.tooltip);
                                ajoutMarker(new LatLng(45.2,5.6), "mon titre",  
"mon contenui",
new MarkerStyleIci(), "tooltip");
                        //}

                }

        }
}

 When i load the following method : chargeXMl(url) i get the following
errors :

Error: Object not initialized
        at com.google.maps.wrappers::Wrapper$/checkValid()
        at com.google.maps.wrappers::IMapWrapper/setCenter()
        at batman::GmapNQ/ajoutMarker()[Z:\sentiers debattus\projets
\www.sentiers-debattus.com\web\swf\batman\GmapNQ.as:104]
        at batman::GmapNQ/batman:GmapNQ::chargementComplet()[Z:\sentiers
debattus\projets\www.sentiers-debattus.com\web\swf\batman\GmapNQ.as:
201]
        at flash.events::EventDispatcher/
flash.events:EventDispatcher::dispatchEventFunction()
        at flash.events::EventDispatcher/dispatchEvent()
        at flash.net::URLLoader/flash.net:URLLoader::onComplete()
Created wrapper for: IMapsFactory


do you know why i get this errors  ? Thanks a lot

-- 
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.

Reply via email to