Guys

Thanks a lot for all the input.
Shaun, your advice was spot on. Casting type did the trick. Will continue
updating that example to suit my needs.

As for my first issue, please find additional info below:

*MapSimple.mxml*

 <?xml version="1.0" encoding="utf-8"?>
<mx:Application
 xmlns:mx="http://www.adobe.com/2006/mxml";
 xmlns:maps="com.google.maps.*"
 width="640"
 height="480"
 layout="absolute"
 creationComplete="creationCompleteHandler(event)">

 <maps:Map
  id="map"
  sensor="false"
  key="API_KEY"
  mapevent_mapready="onMapReady(event)"
  width="100%"
  height="100%"/>

 <mx:Script>
  <![CDATA[

   import com.google.maps.InfoWindowOptions;
   import com.google.maps.LatLng;
   import com.google.maps.Map;
   import com.google.maps.MapEvent;
   import com.google.maps.MapMouseEvent;
   import com.google.maps.controls.ZoomControl;
   import com.google.maps.overlays.Marker;
   import com.google.maps.overlays.MarkerOptions;
   import com.google.maps.services.ClientGeocoder;
   import com.google.maps.services.ClientGeocoderOptions;
   import com.google.maps.services.GeocodingEvent;

   import mx.controls.Alert;
   import mx.core.FlexGlobals;
   import mx.events.FlexEvent;

   private var LocationName:String;
   private var PostCode:String;

   private function onMapReady(event:Event):void {
    map.enableScrollWheelZoom();
    map.enableContinuousZoom();
    map.addControl(new ZoomControl());
    map.setZoom(15);
    doGeocode(PostCode);
   }

   private function doGeocode(PostCode:String):void {

    var geocoder:ClientGeocoder = new ClientGeocoder();

    geocoder.addEventListener(GeocodingEvent.GEOCODING_SUCCESS,
     function(event:GeocodingEvent):void {

      var placemarks:Array = event.response.placemarks;

      if (placemarks.length > 0) {

       map.setCenter(placemarks[0].point);
       var options:MarkerOptions = new MarkerOptions(
        {label: "Here",
         tooltip: LocationName,
         hasShadow: true,
         clickable: false,
         draggable: false,
         radius: 16});

       var marker:Marker = new Marker(placemarks[0].point,options);

       marker.addEventListener(MapMouseEvent.CLICK,
        function (event:MapMouseEvent):void {
         marker.openInfoWindow(new InfoWindowOptions({content:
placemarks[0].address}));
        });

       map.addOverlay(marker);

      }

     });

    geocoder.addEventListener(GeocodingEvent.GEOCODING_FAILURE,
     function(event:GeocodingEvent):void {

      Alert.show("Geocoding failed");
      trace(event);
      trace(event.status);

     });

    geocoder.geocode(PostCode);

   }
   protected function creationCompleteHandler(event:FlexEvent):void
   {
    PostCode=FlexGlobals.topLevelApplication.parameters.PostCode;
    LocationName=FlexGlobals.topLevelApplication.parameters.LocationName
   }
  ]]>
 </mx:Script>
</mx:Application>

*Separate application (lets call it MapLoader.mxml):*
*SimpleMapPopup.mxml (component used as popup):*

<?xml version="1.0" encoding="utf-8"?>
<mx:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009";
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    layout="absolute"
    width="642"
    height="513"
    title="Selected location"
    showCloseButton="true"
    close="PopUpManager.removePopUp(this)"
    creationComplete="creationCompleteHandler(event)">

 <fx:Script>
  <![CDATA[

   import mx.events.FlexEvent;
   import mx.managers.PopUpManager;

   public var PostCode:String;
   public var LocationName:String;
   public static const   simple_map_url:String="
http://www.SomeDomain.com/MapSimple.swf";;

   protected function creationCompleteHandler(event:FlexEvent):void
   {
    SimpleMapLoader.source=simple_map_url + "?PostCode=" + PostCode + 
"&LocationName=" +
LocationName;
    SimpleMapLoader.load();
   }
  ]]>
 </fx:Script>

 <mx:Canvas width="100%" height="100%">

  <mx:SWFLoader
   id="SimpleMapLoader"
   width="640"
   height="480"/>

 </mx:Canvas>

</mx:TitleWindow>

*Calling popup from main application:*

    var SimpleMapPU:SimpleMapPopup =
SimpleMapPopup(PopUpManager.createPopUp(this, SimpleMapPopup, true));

    SimpleMapPU.PostCode=PostCode;
    SimpleMapPU.LocationName=LocationName;

    PopUpManager.centerPopUp(SimpleMapPU);

As I mentioned, if I will render map (MapSimple.swf) inside the browser (new
tab) without flex popup (wrapper) all the controls works fine. Only when
rendered inside Flex popup some controls go totally bonkers or simply dont
work.

Regards
Michael

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps API For Flash" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/google-maps-api-for-flash/-/ehfeXZr1XkMJ.
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