Hi Justin,
I don't pass the DIV into Flex. I render street view in a DIV on top
of the Flash movie. In the Flex app I have an empty Box that is where
I want the street view to render. Whenever that Box shows, hides,
resizes or moves I have to call the JS function so that the DIV
repositions appropriately.
Jesse
The Flex side:
private function syncStreetViewPosition() : void {
var global : Point = streetViewMask.localToGlobal(new Point(0,
0));
if (map.ready) {
ExternalInterface.call("positionStreetView",
streetViewMask.visible, streetViewMask.width, streetViewMask.height -
1,
global.x, global.y + 1, null, null);
if (_appState.streetViewLatLng == null &&
_appState.showStreetView) {
_appState.streetViewLatLng = map.map.getCenter();
ExternalInterface.call("setStreetViewLocation",
_appState.streetViewLatLng.lat(), _appState.streetViewLatLng.lng(),
null, null);
}
}
}
<mx:Box id="streetViewMask" styleName="idStreetViewPane"
height="{getStreetViewHeight(rightCol.height)}" width="100%"
visible="{_appState.showStreetView}"
includeInLayout="{_appState.showStreetView}"
resize="syncStreetViewPosition()"
show="syncStreetViewPosition()" hide="syncStreetViewPosition()"
move="syncStreetViewPosition()"
verticalAlign="middle" horizontalAlign="center">
<mx:Label text="Loading Street View..." fontSize="48"
color="#D6DBE1"/>
<mx:Label id="svError" text="Drag the man icon to a road
to load Street View"
fontSize="16" color="#F6FAFF" visible="false"
fontWeight="bold"/>
</mx:Box>
The JS side (you can see the full source code at howsfvotes.com):
function positionStreetView(visible, width, height, left, top,
right, bottom) {
var div = document.getElementById("streetView");
if (visible && width > 0 && height > 0) {
div.style.width = width + "px";
div.style.height = height + "px";
if (left != null)
div.style.left = left + "px";
else
div.style.right = right + "px";
if (top != null)
div.style.top = top + "px";
else
div.style.bottom = bottom + "px";
if (!streetViewRequested) {
loadStreetView();
} else if (panorama) {
panorama.checkResize();
}
} else {
div.style.left = (-1 * parseInt(div.style.width) - 100) + "px";
}
}
function setStreetViewLocation(lat, lon, yaw, pitch) {
if (client) {
client.getNearestPanoramaLatLng(new GLatLng(lat, lon), function
(latLon) {
if (latLon)
panorama.setLocationAndPOV(latLon, yaw != null ?
{yaw:yaw, pitch:pitch} : null);
else if (lastLat != null)
updateFlexClient();
else
showNoPositionError();
});
} else if (lat != null) {
pendingArgs = [lat, lon, yaw, pitch];
}
}
On Dec 15, 6:41 am, Justin <[email protected]> wrote:
> Nice work Jesse,
>
> I have been looking at doing something similar. I looked through your
> source code and the only question I have is how do you pass the
> streetView div back into the Flex app? I have seen a few other
> similar examples, but the streetview takes up the entire bottom of the
> screen. I like how you have it just below the map. Too bad Google
> hasn't made StreetView part of the Flash API.
>
> Thanks,
>
> Justin
>
> On Nov 21, 1:32 pm, Jesse <[email protected]> wrote:
>
>
>
> > Hi,
>
> > street view is not part of the flash API. However you can use the
> > flash ExternalInterface for the necessary two way communication
> > between flash and JavaScript. I did this onhttp://www.howsfvotes.com
> > It took me about a day to get all the interactions polished. Look at
> > the HTML page source on my site and you should be able to imagine what
> > code is necessary on the flash side.
>
> > Jesse
>
> > On Nov 19, 1:29 pm, thodoris <[email protected]> wrote:
>
> > > Is GStreetviewPanorama available in flash maps api?
> > > Maybe a beta version that i can test?
>
> > > If not do you think i will integrate easily the flash map api with
> > > some external javascript calls to the JavaScript api?
>
> > > thanks for any hint or advice
--
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.