Tuesday, October 7, 2008

Flex Tips (OR: Examples I Wish Had Been Easier to Find)

So, in the last several months of supporting our new Maps API for Flash and learning all about this new fangled thing called Flex, I've discovered some things:
1) OMG I love Flex and the fact that I can create a ColorSelector natively, and the fact that I can "bind" dynamic variables as data sources to UIComponents. I'm very close to deprecating my love for JavaScript.
2) There are alot of ways to use Flex components, and I often find that the way that I want to use a component is possible..but not example-ified enough.

So this post is just a collection of Flash API samples (shamefully copy and pasted from the demo gallery) that use Flex stuff in nifty ways. Hopefully I've now somehow helped future developers looking for examples. :)

Context Menu  This demo shows how to create a context menu on the map that gives the user an "Add Marker" option. When selected, a marker is created on the map at the clicked location.
Non-Map Classes used: ContextMenu, ContextMenuItem
View the source
Polygon with Effects & Filters  This demo shows a polygon with a DropShadowFilter applied, and a Glow effect applied to that polygon on mouseover. Any filter or effect can be applied to a polygon or polyline.
Non-Map Classes used: Glow, DropShadowFilter
View the source
TabNavigator InfoWindow  This demo shows how to use customContent to put a UIComponent (TavNavigator) inside an infowindow and create the effect of tabbed info windows.
Non-Map Classes Used: TabNavigator, VBox, UIComponent, TextArea
View the source
KML Parser  This demo uses the open source KML DOM parsing library from the utility library to parse a KML file and create a sidebar Tree list and corresponding map overlays.
Non-Map Classes Used: Tree
View the source
Store Locator  This demo lets the user enter an address, pick a radius, and then it queries a database through a PHP script, parses the resulting XML, and adds the resulting markers to the map and the store information to a sortable DataGrid.
Non-Map Classes Used: ComboBox, DataGrid, itemRenderer, DataGridColumn
View the source
Driving Directions with DataGrid  Lets the user enter to/from in a form and displays the steps in a customized DataGrid, and displays static maps in the info windows for each step.
Non-Map Classes Used: DataGrid, DataGridColumn, itemRenderer, ArrayCollection
View the source
PolygonOptions Playground  Lets you experiment with the properties of PolygonOptions (including the GradientStyle) and see the resulting Polygon placed on the map.
Non-Map Classes Used: Grid, GridRow, ColorPicker, ComboBox, HSlider
View the source


Unknown said...

Thank you, that gives me a bunch of stuff to chew over for the weekend. Well, when I'm not power cycling servers or watching the V8s attack Bathurst. =)

Shark said...


This is great info... but how can i use the files of these demos inside FlashCS3? If you could please show me the way...