Adobe Flex 3 Help

Understanding the automation flow

When the application is initialized, the AutomationManager class is created. In its init() method, it adds a listener for Event.ADDED events.

The following image shows the order of events when the application is initialized and the AutomationManager class constructs the delegate map.

The order of events when the application is initialized and the AutomationManager class constructs the delegate map.

  1. The SystemManager class creates the display list, a tree of visible objects that make up your application.
  2. Each time a new component is added, either at the root of the display list or as a child of another member of the display list, SystemManager dispatches an Event.ADDED event.
  3. AutomationManager listens for the ADDED event. In its ADDED event handler, it calls methods on the Automation class. It then instantiates the delegate for that class.
  4. The Automation class maps each component in the display list to its full class name.
  5. When it is created, the delegate class adds a reference to its instance in the delegate class map. The delegate class then handles events during record and play-back sequences.

    The delegate is now considered registered with the component. It adds event listeners for the component's events and calls AutomationManager when the component triggers those events.

After the components in the display list are instantiated and mapped to instances of their delegate classes, AutomationManager is ready to listen for events and forward them to the agent for processing.

The following image shows the flow of operation when a user performs an action that is a recordable event. In this case, the user clicks a Button control in the application.

Flow of operation for a recordable event.

  1. The user clicks the Button control in the Flex application. The SystemManager dispatches a MouseEvent.CLICK event.
  2. The ButtonAutomationImpl class, the Button control's automation delegate, listens for click events. In the delegate's click event handler, the delegate calls the AutomationManager recordAutomationEvent() method. (It is likely that the button also defines a click event handler to respond to the user action, but that is not shown.)
  3. The AutomationManager recordAutomationEvent() method dispatches an AutomationRecordEvent.RECORD event. In that event, the replayableEvent property points to the original click event.
  4. The custom agent class listens for RECORD events. When it receives the RECORD event, it uses the replayableEvent property to access the properties of the original event.
  5. The agent records the event properties in a database, logs the event properties, or gets information about the user before recording them.