Try setting creationPolicy="all" on the tabNavigator

i.e <mx:TabNavigator id="tn" x="10" y="10" width="734" height="471"
creationPolicy="all">



On Feb 19, 9:19 pm, Israel <[email protected]> wrote:
> We are having an issue with our map component where it fails to
> properly initialize, it seems, when placed in any tab other than the
> first tab within a tabNavigator.
>
> It seems like it's having an issue with not being created on
> application load since it only begins initializing once the tab is
> clicked.
>
> Has anyone else come across this and if so what is the exact reason
> for it?
>
> It seems it kind of works if the selectedIndex of the tabNavigator is
> set to the tab which contains the map but even then it sporadically
> throws the error.
>
> Does anyone have a better fix/workaround?
>
> I appreciate any help and/or feedback.
>
> The error can be reproduced with the following simple example:
>
> <?xml version="1.0" encoding="utf-8"?>
> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml";
> layout="absolute" xmlns:maps="com.google.maps.*">
>         <mx:TabNavigator id="tn" x="10" y="10" width="734" height="471">
>           <mx:Canvas label="Tab 1" width="100%" height="100%">
>                 <mx:DataGrid x="20" y="26">
>                         <mx:columns>
>                                 <mx:DataGridColumn headerText="Column 1" 
> dataField="col1"/
>
>                                 <mx:DataGridColumn headerText="Column 2" 
> dataField="col2"/
>
>                                 <mx:DataGridColumn headerText="Column 3" 
> dataField="col3"/
>
>                         </mx:columns>
>                 </mx:DataGrid>
>
>           </mx:Canvas>
>           <mx:Canvas label="Tab 2" width="100%" height="100%">
>                 <maps:Map key="">
>
>                 </maps:Map>
>           </mx:Canvas>
>     </mx:TabNavigator>
> </mx:Application>
>
> The error received is the following:
>
> 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()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx
> \core\UIComponent.as:5083]
>         at mx.core::Container/addChildAt()[C:\autobuild\3.2.0\frameworks
> \projects\framework\src\mx\core\Container.as:2215]
>         at mx.core::Container/addChild()[C:\autobuild\3.2.0\frameworks
> \projects\framework\src\mx\core\Container.as:2140]
>         at mx.core::Container/createComponentFromDescriptor()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\Container.as:3681]
>         at mx.core::Container/createComponentsFromDescriptors()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\Container.as:3493]
>         at mx.containers::ViewStack/instantiateSelectedChild()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\containers\ViewStack.as:
> 1140]
>         at mx.containers::ViewStack/commitProperties()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\containers\ViewStack.as:
> 664]
>         at mx.containers::TabNavigator/commitProperties()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\containers\TabNavigator.as:
> 504]
>         at mx.core::UIComponent/validateProperties()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5807]
>         at mx.managers::LayoutManager/validateProperties()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:
> 539]
>         at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:
> 689]
>         at Function/http://adobe.com/AS3/2006/builtin::apply()
>         at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
>         at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild
> \3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]
--~--~---------~--~----~------------~-------~--~----~
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