I generally use the maps API within Flex however I think you may be able to resolve this by just moving this line
my_map.addEventListener(MapEvent.MAP_READY, onMapReady); up to the point just below the call to the new Map() constructor, this way before the map has been added to the stage you definitely have your listener registered. It could be that in the first load it takes longer for the event to get dispatched so there's time for it to get to adding that listener before the event is fired, but in the second time other things are already loaded so it's quicker to dispatch the ready event and the listener isn't registered in time. This is just speculation like I said no Flash here so I can't really test. But to the other posters point it is going to be much better to just create the map once and have it stay in memory until it's no longer needed at all rather than destroying and recreating it multiple times. I've used the maps within Flex in an application with multiple maps in tabs and pop-ups and row expansions of advanced data grids so I'm sure it's pretty flexible in terms of loading multiple times in a single Flash file. Shaun -- 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.
