Accessibility

Table of Contents

Expediting Application Development with the Flex Application Starter Toolkit (FAST)

Echo: A Trace and Introspection Tool

Echo is a trace and introspection tool that you can run in a separate browser session alongside the Flex application you are developing. You can use Echo in two distinct ways:

  • A Flex program can write messages to the Echo console
  • A developer can examine Flex programs at runtime using the Echo inspector

Figure 1 shows the Echo Console after a user starts the Echo example application, clicks all three buttons in the application, and uses the Echo Inspector to expand the dummyData object:

The Echo Console after expanding the dummyData object

Figure 1: The Echo Console after expanding the dummyData object

See the Echo Console live at: flexapps.macromedia.com/fast/fastTutorial/fast/echo/console/EchoConsole.mxml

Run the Echo example program at: flexapps.macromedia.com/fast/fastTutorial/_005_EchoExample.mxml

Figure 2 shows the Echo example program user interface:

The Echo Example Application

Figure 2: The Echo Example Application

The following source code is from the Echo example application (_005_EchoExample.mxml). Take note of the highlighted items:

<mx:Panel title="Echo">      
        <mx:ControlBar>
            <mx:Button label="Info message"
                   click="Echo.info('This is my info message.');"/> 
            <mx:Button label="Debug message"
                   click="Echo.debug('Debug message.');"/>
            <mx:Button label="Error message"
                   click="Echo.error('Error message!  TILT!');"/>   
        </mx:ControlBar>                
    </mx:Panel>                                            
    <mx:Script>
        import fast.echo.Echo;

        var dummyData:Object;

        private function initApp(){
            //  Initialize Echo
            Echo.enableDebug();
            Echo.clearConsole();

            //  Log a message
            Echo.debug("Application initialized");             

            //  Initialize dummy data
            dummyData = new Object();
            dummyData.stringParameter = "This is a string";
            dummyData.dateParameter = new Date();
            dummyData.objectParameter = {parm1:"hello",
                                         parm2:"Kaiser Sosay",
                                         parm3:12345};
            dummyData.arrayParameter = new Array(); 
            dummyData.arrayParameter.push(123);
            dummyData.arrayParameter.push(45.6);
            dummyData.arrayParameter.push("seven eight nine");
        }        
    </mx:Script>

Notice the following important points in this example:

  • All the Echo methods are static. To use them you only need to import fast.echo.Echo.
  • The Echo console is located in the FAST library at fast\echo\console\EchoConsole.mxml. When you start the application you are monitoring, the console must be running.
  • Timestamp information can be very useful for performance tuning and diagnostic purposes. From timestamps in this example you can see that the application took 196 ms to initialize and the user started clicking roughly three seconds after the application started to run.

Find additional information about Echo in the FAST API documentation included with the FAST download in the Requirements section.