Application architecture

This page describes an older version, please read about the latest version at:
http://resources.arcgis.com/en/help/flex-viewer/concepts/

Application architecture for the ArcGIS Viewer for Flex

The ArcGIS Viewer for Flex is designed to help develop and deploy focused web mapping applications that can fully leverage the power of server side spatial services. These services can be provided by ArcGIS for Server, ArcGIS Online, or other web data sources, such as GeoRSS feeds.

Application life cycle

The Flex Viewer application follows the basic flow of any Flash application.

  1. The wrapper file (usually index.html or default.htm) is loaded by the browser.
  2. Checks for the appropriate version of Flash Player.
  3. Loads the SWF (Flash) file (the application) in Flash Player.

The Flex Viewer application consists of widgets that only load when needed. Each widget is implemented as a Flex module. The Flex Viewer application therefore follows the same basic flow as any other Flex application using Flex modules.

What does this mean for the life cycle of your application? The basic life cycle from an application's point of view, from starting the application to the user’s interaction with widgets, includes the following five major life cycle events:

  1. Flash Player starts the Flex Viewer application by loading and running index.swf, the main application file.
  2. In the main application file, index.swf, the ViewerContainer loads the configuration Extensible Markup Language (XML) file using ConfigManager, which populates configData with the information from the main configuration file.
  3. Based on the configuration settings, MapManager loads the map services.
  4. Based on the configuration settings, WidgetManager loads the widget's Flash files from the uniform resource locators (URLs) specified in the configuration file.
  5. Users interact with the application. As users open the new widget, they will be flexdownloaded as needed.

Understanding the Widget Programming Model

A compiled widget is a stand-alone SWF file that can be shared, moved, and deployed in other Flex Viewer applications.

Typically, a widget encapsulates a set of isolated and focused business logic that allows users to perform a task. In addition, the widget usually provides a visual interface for the user. However, a widget can also add non-visual functionality such as using Google Analytics to log widget usage. The lightweight Widget Programming Model that comes with the Flex Viewer allows developers to easily develop custom widgets without having to deal with the low level coding required to integrate their widgets into the Flex Viewer application.

The following are basic steps to develop a widget:

  1. Extend the BaseWidget.
  2. Write code.
  3. Compile the widget.
  4. Add the new widget to the main configuration file (config.xml).
The WidgetManager automatically manages the widget's life cycle.

Widget naming convention

NoteNote:

See the Samples/HelloWorldWidget folder for an example of these naming conventions.

2/15/2012