To this point, I’ve been putting Google Maps into Air applications due to the Flash Sandbox issue encountered in PV3D (discussed in a previous post). But in CS4, guess what, it’s not an issue. They go right on the web as you can see from the demo below:
Now here is how you do it, and it’s so simple you will not believe it. Use the code below to put your map into a movie where it’s free to move freely in 3D.
Placing a Google Map on a CS4 Plane is easier in Flex 4 (Gumbo) than it is in PV3D. All you do is throw your map into a movie clip using the code below, and then center it to get your map pivot right. The code snippet below sets your map in a movie clip, centers its pivot, sets map controls, places your movie in a Flex canvas, and centers your movie on the stage.
//Place your map in a movie so you can position its pivot
//Set your map pivot
//Add Map Controls
//Put your movie in a Flex Canvas
//Center your Movie
The map also has two additional Flex components; a button, which stops it from spinning and a slider, which adjusts its speed and direction of rotation.
This is the great power of CS4 over PV3D. You can now bring native Flex components into your 3D environment in conjunction with your 3D objects. Bringing Flex components into PV3D is a difficult task and requires the use of the draw BitmapData feature. But with CS4 it occurs natively, and those components can be manipulated in 3D as well.
Hey that’s it, how crazy can that be! And all the controls and buttons are fully functional and in the right place.
Note: You could have just rotated the map directly, but you put it in a movie to control positioning and its pivot point.
The rest of the code is shown in the link below and discussed in greater detail in Chapter 7 of the book.