Hi Jamie- Re the last suggestion: there is a flex version of the SWC and a non-flex version. The flex version is denoted by "_flex" in the filename, and should be used only when you're using the <Map> component. If using within a UIComponent, you should use the normal, non-flex version.
- pamela On Fri, Nov 14, 2008 at 9:32 AM, JamieJag <[EMAIL PROTECTED]> wrote: > > Pamela, > > I've been getting the same error while using ver 1.7 of the API, but > not with 1.6 or below. Regarding your suggestions, > a. calling setSize before addChild - not sure how to do it, as the > parameters that I'd be passing to setSize depend upon the size of the > parent container (I'm adding a map inside a UIComponent in my own > ActionScript class, and so setSize is usually called in > updateDisplayList of my class). > b. Since I'm using ver 1.7 of the API, I'm using the MAP_PREINITIALIZE > event along with MapOptions to set center, etc.(as per > http://code.google.com/apis/maps/documentation/flash/basics.html#MapOptions > ). > c. What exactly do you mean by the last suggestion? (use the non-Flex > version????) > > -Mahesh > > On Nov 11, 6:26 am, "pamela (Google Employee)" <[EMAIL PROTECTED]> > wrote: > > Hi Pablo- > > A few suggestions: > > Call setSize before calling addChild. > > Add an event listener for MAP_READY, and center the map inside the > handler. > > Make sure you're using the non-Flex version of the SWC. > > > > Do any of those suggestions fix the problem? > > > > - pamela > > > > > > > > On Wed, Nov 5, 2008 at 3:55 AM, pabloapa <[EMAIL PROTECTED]> wrote: > > > > > I happen to get the same message while adding a Map on runtime, to a > > > Panel custom component. The latter is included in an MXML Application. > > > > > Adding a maps:Map component works fine. > > > > > Any ideas? > > > > > Thanks, > > > Pablo Apanasionek > > > > > <mx:Panel xmlns:mx="http://www.adobe.com/2006/mxml" > > > xmlns:controls="controls.*" > > > borderThicknessTop="0" > > > borderThicknessLeft="0" > > > borderThicknessRight="0" > > > borderThicknessBottom="0" xmlns:maps="maps.*"> > > > > > <mx:UIComponent id="map" width="100%" height="100%" /> > > > > > <mx:Script> > > > <![CDATA[ > > > import com.google.maps.Map; > > > > > private var mapImpl:Map; > > > > > public function setMapControl():void > > > { > > > mapImpl = new Map(); > > > mapImpl.key = MY_KEY; > > > map.addChild(mapImpl); > > > } > > > > > ]]> > > > </mx:Script> > > > > > </mx:Panel> > > > > > On Oct 24, 1:31 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > wrote: > > > > The solution is to create a UIComponent container for the map. This > > > > works as in the sample below as well as in a popup: > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > <mx:Application > > > > xmlns:maps="com.google.maps.*" > > > > xmlns:mx="http://www.adobe.com/2006/mxml" > > > > creationComplete="complete()" > > > > layout="absolute"> > > > > > > <mx:Script> > > > > <![CDATA[ > > > > import com.google.maps.Map; > > > > import com.google.maps.MapEvent; > > > > > > private var _map:Map; > > > > > > private function complete():void > > > > { > > > > _map = new Map(); > > > > _map.key = "MY SITE KEY"; > > > > _map.setSize(new > > > Point(mapContainer.width, mapContainer.height)); > > > > > _map.addEventListener(MapEvent.MAP_READY, > > > mapReady); > > > > mapContainer.addChild(_map); > > > > } > > > > > > private function > mapReady(event:MapEvent):void > > > > { > > > > trace('mapReady'); > > > > } > > > > ]]> > > > > </mx:Script> > > > > > > <mx:Canvas width="100%" height="100%"> > > > > <mx:UIComponent id="mapContainer" width="100%" > > > height="100%"/> > > > > </mx:Canvas> > > > > > > </mx:Application> > > > > > > On Oct 23, 8:35 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > > > > wrote: > > > > > > > I am trying to integrate google maps into a large java/FDS app I am > > > > > working on. To make a prototype, I have constructed the following > > > > > example: > > > > > > > APPLICATION MXML: > > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > > <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" > > > > > layout="absolute"> > > > > > > > <mx:Script> > > > > > <![CDATA[ > > > > > import mx.managers.PopUpManager; > > > > > > > private function popup():void > > > > > { > > > > > PopUpManager.createPopUp(this, > MapPopup, > > > true); > > > > > } > > > > > ]]> > > > > > </mx:Script> > > > > > > > <mx:Canvas width="100%" height="100%"> > > > > > <mx:Button label="popup" click="popup()" /> > > > > > </mx:Canvas> > > > > > </mx:Application> > > > > > > > MAPPOPUP MXML > > > > > > > <?xml version="1.0" encoding="utf-8"?> > > > > > <mx:Canvas > > > > > xmlns:maps="com.google.maps.*" > > > > > xmlns:mx="http://www.adobe.com/2006/mxml" > > > > > width="400" > > > > > height="300"> > > > > > > > <maps:Map width="100%" height="100%" key="MY SITE KEY"/> > > > > > > > </mx:Canvas> > > > > > > > If you run this app and click the popup button, you will get the > > > > > following stack trace: > > > > > > > TypeError: Error #1009: Cannot access a property or method of a > null > > > > > object reference. > > > > > at com.google.maps::Map/drawBackground() > > > > > at com.google.maps::Map/onAdded() > > > > > at flash.display::DisplayObjectContainer/addChildAt() > > > > > at mx.core::UIComponent/ > > >http://www.adobe.com/2006/flex/mx/internal:: > > > > > > $addChildAt()[E:\dev\3.1.0\frameworks\projects\framework\src\mx\core > > > > > \UIComponent.as:5061] > > > > > at > > > mx.core::Container/addChildAt()[E:\dev\3.1.0\frameworks\projects > > > > > \framework\src\mx\core\Container.as:2208] > > > > > at > > > mx.core::Container/addChild()[E:\dev\3.1.0\frameworks\projects > > > > > \framework\src\mx\core\Container.as:2140] > > > > > at > mx.core::Container/createComponentFromDescriptor()[E:\dev > > > > > \3.1.0\frameworks\projects\framework\src\mx\core\Container.as:3674] > > > > > at > mx.core::Container/createComponentsFromDescriptors()[E:\dev > > > > > \3.1.0\frameworks\projects\framework\src\mx\core\Container.as:3486] > > > > > at > mx.core::Container/createChildren()[E:\dev\3.1.0\frameworks > > > > > \projects\framework\src\mx\core\Container.as:2582] > > > > > at > > > mx.core::UIComponent/initialize()[E:\dev\3.1.0\frameworks\projects > > > > > \framework\src\mx\core\UIComponent.as:5341] > > > > > at > > > mx.core::Container/initialize()[E:\dev\3.1.0\frameworks\projects > > > > > \framework\src\mx\core\Container.as:2519] > > > > > at > > > MapPopup/initialize()[/Users/mreynolds/Documents/gatewayworkspace/ > > > > > GoogleMapsTest/src/MapPopup.mxml:0] > > > > > at mx.managers::SystemManager/ > > >http://www.adobe.com/2006/flex/mx/ > > > > > > internal::childAdded()[E:\dev\3.1.0\frameworks\projects\framework\src > > > > > \mx\managers\SystemManager.as:1639] > > > > > at mx.managers::SystemManager/ > > >http://www.adobe.com/2006/flex/mx/ > > > > > internal::rawChildren_addChildAt()[E:\dev\3.1.0\frameworks\projects > > > > > \framework\src\mx\managers\SystemManager.as:1689] > > > > > at > > > mx.managers::SystemManager/addChild()[E:\dev\3.1.0\frameworks > > > > > \projects\framework\src\mx\managers\SystemManager.as:1225] > > > > > at > > > mx.managers::PopUpManagerImpl/addPopUp()[E:\dev\3.1.0\frameworks > > > > > \projects\framework\src\mx\managers\PopUpManagerImpl.as:263] > > > > > at > > > mx.managers::PopUpManagerImpl/createPopUp()[E:\dev\3.1.0\frameworks > > > > > \projects\framework\src\mx\managers\PopUpManagerImpl.as:178] > > > > > at > > > mx.managers::PopUpManager$/createPopUp()[E:\dev\3.1.0\frameworks > > > > > \projects\framework\src\mx\managers\PopUpManager.as:124] > > > > > at > > > GoogleMapsTest/popup()[/Users/mreynolds/Documents/gatewayworkspace/ > > > > > GoogleMapsTest/src/GoogleMapsTest.mxml:87] > > > > > at > > > GoogleMapsTest/___GoogleMapsTest_Button1_click()[/Users/mreynolds/ > > > > > > Documents/gatewayworkspace/GoogleMapsTest/src/GoogleMapsTest.mxml:100] > > > > > > > I have seen one other post on this forum that included this error > and > > > > > no resolution was posted. In my real app, I am simply trying to > add a > > > > > map to a tab of a tab navigator of the main application view and I > get > > > > > this same error. I am not trying to call any functions or methods > on > > > > > the map, the map has no ID, no listeners, nothing. Still, I can't > get > > > > > a map to even initialize, let alone do anything with it after that > > > > > point. If I move the map mxml tag into the main application, > instead > > > > > of in this popup in the example, it works fine. > > > > > > > Can anyone help me? This issue seems quite easy to reproduce and I > > > > > feel it has been overlooked. I would like to use google maps in my > > > > > flex app!! > > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
