Generate a Polyline from a directions request and store a reference to
that Polyline.
Then unload your map and create an entirely new instance.
Now try adding the existing Polyline to the new map instance, simply
using the addOverlay() method. I get the following:
Error: Abstract class - Cannot instantiate objects of class
IMapWrapper directly
at com.google.maps.wrappers::IMapWrapper()
at com.google.maps.wrappers::Wrapper/wrap()
at com.google.maps.wrappers::Wrapper/wrapIMap()
at com.google.maps.wrappers::IOverlayWrapper/getDefaultPane()
at com.google.maps.wrappers::IOverlayWrapper/getDefaultPane()
at com.google.maps.core::MapImpl/addOverlay()
at com.google.maps.wrappers::IMapWrapper/addOverlay()
It seems that when a Polyline is created it is intrinsically linked
somehow to a specific map instance. I'm hoping that I'm missing
something and I'm completely wrong, but I can't seem to find how.
Thankfully, there is a workaround. Using the PolylineEncoder class I
posted the other day (http://blog.duncanhall.net/2010/02/as3-encoded-
polyline-algorithm-for-google-maps/), if you encode the existing
Polyline, and then create a new one via Polyline.fromEncoded(), then
it can be added to the new map instance!
I'm hoping someone can shed some light on this. I would have thought
that once a Directions request had completed, the 'createPolyline()'
method would return a self contained object of Lat/Lng points that had
no dependencies on any other classes?
--
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.