Hi, I wrote a little Flex app utilizing Google Maps in one part and it
works fine. Now the app became a little bit more complex so I decided
to use states. Here I am running into error #1009. I tried to minimize
the code and the following is the outcome. With this code I still get
the error. Could you help me out here, because I don't understand the
error message of the Flash viewer.

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
        layout="absolute"
        verticalAlign="middle"
        backgroundColor="white"
        creationComplete="init();">

<mx:Panel id="pnlMain" width="885" height="750"
        layout="absolute" />

<mx:states>
        <mx:State name="state0">
                <mx:AddChild relativeTo="{pnlMain}" position="lastChild">
                        <mx:Box width="600" height="100%">
                                <mx:UIComponent id="mapContainer"
                                width="100%"
                                height="100%"/>
                </mx:Box>
        </mx:AddChild>
        </mx:State>
</mx:states>

<mx:Script>
    <![CDATA[

                import com.google.maps.*;
                        import com.google.maps.controls.*;
                        import com.google.maps.interfaces.*;
                        import com.google.maps.overlays.*;
                        import com.google.maps.services.*;
                        import com.google.maps.styles.*;

            private var googleMap:Map;

            private function init():void {
                googleMap = new Map();
                googleMap.key = "your Key"
                googleMap.addEventListener(MapEvent.MAP_READY,
googleMap_mapReady);
                googleMap.setSize(new Point(mapContainer.width,
mapContainer.height));
                googleMap.addControl(new ZoomControl());
                googleMap.addControl(new MapTypeControl());
                googleMap.addControl(new OverviewMapControl());
                googleMap.addControl(new PositionControl());

                mapContainer.addChild(googleMap);
            }

            private function googleMap_mapReady(event:Event):void
{
                        googleMap.removeMapType(MapType.NORMAL_MAP_TYPE);
                        googleMap.removeMapType(MapType.HYBRID_MAP_TYPE);
                        //
MapType,MapType.NORMAL_MAP_TYPE, .SATELLITE_MAP_TYPE, .PHYSICAL_MAP_TYPE,
HYBRID_MAP_TYPE
                        googleMap.setCenter(new LatLng(76, -42.258911), 3,
MapType.PHYSICAL_MAP_TYPE);
                        googleMap.enableScrollWheelZoom();
                googleMap.enableContinuousZoom();
                googleMap.savePosition();
                }

    ]]>
</mx:Script>
</mx:Application>

Thank you,
Thomas

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