首先介绍下Alcon:(翻译未完全,待续...英文水平差,有错误的地方见谅...)
- About
- Quickstart
- Alcon Console
- Menu
- App Monitor
- Keyboard Shortcuts
- Debug API
- API Installation
- API Documentation
- External Links
- Alcon Website
- Alcon Support Forum
1. About
Alcon is a Debugging Tool for ActionScript developers that provides several straightforward and quickly accessible methods to debug and monitor any ActionScript 2 or ActionScript 3 application. It consists of two parts: the Alcon Console which is used as an output receiver and the Debugging API which is being imported into any debugable code and sends debug data to the Alcon Console.
Alcon 为 AS开发人员 提供简单直接,方便快捷的ActionScript 2或ActionScript 3应用程序调试方法和监视器.主要分为两部分功能:Alcon控制台应用程序用于接收程序输出给Alcon的调试数据
At it's most basic use Alcon provides a trace method similar to ActionScript's own trace method with that any output can be sent to Alcon's trace logger but it also offers other features like an Object Inspector to list the propertties of any object, an App Monitor to monitor frame rate and memory usage and File Loggers to constantly monitor log files. Alcon can be used with the Flex compiler, the Flash IDE or MTASC.
2. Quickstart
First follow the API Installation Steps. Once that's done, using Alcon it is straightforward! The static Debug API can be used in any ActionScript 2 and 3 class by simply importing the Debug class with:
import com.hexagonstar.util.debug.Debug;
... and then using any of the Debug class methods anywhere in your class, most commonly trace:
Debug.trace("Never trust a computer you can't throw out a window.");
Please check the API Documentation for a full list of supported methods and their details.
3.1 Menu
- Log
- Pause - Pauses all components. The App Monitor is not affected by this.
- Clear - Clears all output panels and the Object Inspector.
- Reset - Resets the Console. All components are being brought to the initial state.
- Options... - Opens the Options Dialog.
- Exit - Quits the application.
- Edit
- Copy Output - Copies the whole content of the currently displayed panel to the clipboard. If the Object Inspector is displayed and is inspecting any object, the object is being copied in the serialized XML format that is being used by Alcon's Object Inspector.
- Copy Output as HTML - Copies the content to the clipboard with HTML tags used by Alcon. This only works with the Trace- and File Loggers.
- View
- Display Keywords - Toggles showing Filter Level Keywords on/off in the Trace Panel.
- Display MTASC Trace Origins - Toggles showing MTASC Trace Origins on/off in the Trace Panel. This only has an effect when compiling AS2 with MTASC.
- Stay On Top - Toggles the Alcon window to stay on top of other windows.
- Help
- Help... - Opens the Help Panel.
- About... - Displays the About Dialog.
3.2 App Monitor
Alcon's App Monitor can be used to monitor an application's framerate, frame render time and memory consumption. When monitoring any application the top area of the App Monitor is displaying the following information:
- Runtime Information. (AS3 only) This information consists of the computer platform (WIN/MAC/UNIX), the Runtime version and whether the Runtime is a Debugging Runtime or not (signaled by a 'D'). Clicking this text will output all properties provided by System.Capabilities to the Trace Panel.
- FPS: The current and maximum framerate.
- FRT: The frame render time.
- MEM: The memory usage in Megabyte. (AS3 only)
The App Monitor Graph displays the framerate in white, the Frame Render time in blue and the memory consumption in yellow. The upper limit for the memory meter can be changed in the Options in the App Monitor page.
To use the App monitor use the Debug.monitor() method. The monitor method requires the application's stage object as an argument (for ActionScript 2 this should be _root and also the top framerate is required as an argument). optionally a poll interval can be specified with that the App Monitor will update. The default is 500 milliseconds.
import com.hexagonstar.util.debug.Debug;
public class Test extends Sprite
{
public function Test()
{
/* Update App Monitor once a second */
Debug.monitor(stage, 1000);
}
}
The mark() method can be used to place a vertical marker line in the App Monitor's graph at any time. Optionally a color for the marker can be specified:
/* Place a red marker */
Debug.mark(0xFF0000);
It is recommended to use the monitor() calll early in the monitored application, for example in the first occuring constructor. For more information about the monitor API see the API Documentation.
3.3 Keyboard Shortcuts
<P> Pause/Unpause Trace & File Loggers
<DEL> Clear the currently displayed panel
<CTRL + DEL> Clear all panels
<R> Reset
<CURSOR RIGHT> Switch to next panel
<CURSOR LEFT> Switch to previous panel
<CTRL + H> Open Help panel
<CTRL + O> Open Options dialog
<HOME> Scroll to top
<END> Scroll to bottom
4.1. API Installation
Before Alcon can be used, the Debug classes (or the alcon.swc for AS3) need to be copied to your classpath folder. After Alcon has been installed you can find these files for ActionScript 2 and 3 in the following location ...
On Windows (32bit): C:\Program Files\Hexagon Star Softworks\Alcon\debug
On Windows (64bit): C:\Program Files (x86)\Hexagon Star Softworks\Alcon\debug
On Mac OSX: Right-click on the Alcon icon and choose 'Show Package Contents', then in the appearing folder open Contents/Resources/debug
To use the Debug classes follow these steps ...
For ActionScript 3:
Copy the file alcon.swc from the path described above to your preferred path that you are using for your ActionScript 3 thirdparty classes and SWCs (on Windows you can also add this folder directly to your classpath).
When using the Flex mxmlc compiler the alcon.swc can be added to the library path with the library-path argument.
For use with the Flash IDE add the .../debug/as3 folder to the class pathes used by the Flash IDE so that Flash can access the Debug class in the com.hexagonstar.util.debug package. This can be done in the Flash IDE under Preferences/ActionScript/ActionScript 3.0 Settings.
For ActionScript 2:
Copy the as2 folder from the path described above to the classpath that you are using for your ActionScript 2 thirdparty classes. The package structure com.hexagonstar.util.debug must remain the same.
When using MTASC the Debug class can be added to MTASC's class path with the -cp argument.
For use with the Flash IDE add the .../debug/as2 folder to the class pathes used by the Flash IDE so that Flash can access the Debug class in the com.hexagonstar.util.debug package. This can be done in the Flash IDE under Preferences/ActionScript/ActionScript 2.0 Settings.