Graphics Programs Reference
In-Depth Information
Like in Illustrator, you can think of the full interactive as a bunch of layers.
In ActionScript and Flash, the first layer is the stage. You set it to not scale
objects when you zoom in on it, and you align the stage in the top left. Next
you initialize the map with the mapWidth and mapHeight that you specified in
the variables, turn on interaction, and use map tiles from OpenStreetMap.
By setting the map extent to the preceding code, you frame the map
around the United States.
The coordinates in MapExtent() are latitude and longitude which set the
bounding box for what areas of the world to show. The first and third num-
bers are latitude and longitude for the top left corner, and the second and
fourth numbers are latitude and longitude for the bottom right.
Finally, add the map (with addChild() ) to the stage. Figure 8-40 shows the
result when you compile the code without adding any filters to the map.
You can either press the Play button in the top left of Flex Builder, or from
the main menu, you can select Run ➪ Run Openings.
FIGurE 8-40 Plain map using OpenStreetMap tiles
When you run Openings, the result should pop up in your default browser.
There's nothing on it yet, but you can click-and-drag, which is kind of cool.
Also if you prefer a different set of map tiles, you can use the Microsoft
road map (Figure 8-41) or Yahoo! hybrid map (Figure 8-42).
Search WWH ::




Custom Search