3.2 Flash UI Components Set 2 and Flash Charting Controls

Flash developers can create custom components and other Flash authoring elements, called extensions. The Extension Manager allows developers to package and share their own extensions or install packages developed by others. Many developers have already done this, and you can find extensions all over the Internet, particularly on the Macromedia Exchange, as noted earlier. Components are one type of extension. Flash 2004 and Flash Pro offer a new JavaScript extensibility layer that allows you to customize the Flash authoring tool interface, but here we are referring to ActionScript extensions, which offer enhanced runtime features.

Macromedia has released its own free extensions, including the UI Components Set 2 and the Flash Charting Controls, both outlined in Table 3-2. Each of these useful sets of components is available as a separate download from the Macromedia Exchange at http://www.macromedia.com/exchange, and also on the Studio MX CD-ROM in the \Flash MX\Extending Flash MX folder. Once installed, the UI Components Set 2 and Flash Charting Controls are fully documented under Window Component Help - UI Set 2 and Window Component Help - Charts, and within the Reference panel (Window Reference) in Flash MX and under the Help panel in Flash 2004 and Flash Pro.

Table 3-2. Standard UI Components Set 2 and Charting Controls, showing code hint suffixes and object types

Component

Object type

Code hints suffix

BarChart[2]

FBarChart

_bc

Calendar

FCalendar

None

DraggablePane

FDraggablePane

_dp

IconButton

FIconButton

_ib

LineChart[2]

FLineChart

_lc

MessageBox

FMessageBox

_mb

PieChart[2]

FPieChart

_pc

ProgressBar

FProgressBar

_pr

SplitView

FSplitView

None

Ticker

FTicker

_tick

Tree[2]

FTree

_tr

TreeNode (individual nodes of a Tree)

FTreeNode

_tn

[2] Data-aware component

Here is a brief description of each of these additional UI components. Of particular interest to the Flash Remoting developer are the Calendar, MessageBox, Tree, and ProgressBar components:

Calendar

The Calendar component is extremely useful because it offers a visual way to input a date or range of dates. You can specify a Calendar's change handler using FCalendar.setChangeHandler( ).

DraggablePane

The DraggablePane component gives you an interface within an interface; you can attach other interface elements to the DraggablePane so that you can have a draggable interface that floats on top of your Flash movie.

IconButton

The IconButton component is similar to a standard PushButton, but you can attach a custom image to the face of the button. IconButton instances, unlike PushButtons, react to onChange events rather than onClick events. You can specify an IconButton's change handler with FIconButton.setChangeHandler( ).

MessageBox

A MessageBox component creates a convenience pop-up dialog box, much like a JavaScript alert box, with one of four configurations: Info, Question, Warning, or Error. The MessageBox has a close handler that can be specified with FMessageBox.setCloseHandler( ). The close handler callback function receives two arguments: the name of the MessageBox and the index of the button that was clicked.

ProgressBar

The ProgressBar component is typically used in preloaders, but it will graphically show the progress of anything that takes a long time to execute. It can be used within a Flash Remoting application to indicate the load time for a recordset from a remote method.

SplitView

The SplitView component allows you to split the user interface into distinct areas that can be scrolled or resized.

Ticker

The Ticker component gives you a way to scroll content perpetually in the Flash movie, such as in a stock ticker. In a Flash Remoting application, this content can be easily loaded dynamically from a remote source.

Tree

The Tree component, which displays a typical tree of content, is one of the more useful data-aware components. The content can be created manually or it can come from an XML feed or other data source, such as a recordset.

Charting Controls

The Charting Controls are a separate package from the UI Components Set 2, and they must be installed separately. The package includes BarChart, LineChart, and PieChart components. Charts are a huge part of dynamic application development. Using the Charting Controls, you can create a dynamic bar, line, or pie chart using the data returned by a remote service. The Charting Controls work in a fashion similar to the other UI components and are data-aware. Later in this chapter, under Section 3.6.2, I present an example that uses the Flash Charting Controls in conjunction with a RecordSet object. Third-party charting components are also available. For example, B-Line Express (http://www.blinex.com) sells a package of charting components that provide a flexible and extensible library of charting and graphics functions for displaying data as pie charts, bar charts, and much more.



    Part III: Advanced Flash Remoting