Function:
Flash calls some methods to view the data output by the flash trace method on the webpage;
Method:
1. init (w, h, z); // w indicates the width of the display interface, h indicates the height of the display interface, and z indicates the level (preferably at the top layer ); <this method can be omitted>
2. trace (str); // data to be output;
Usage:
1. Import jdhcn. js and click to download jdhcn. js.
2. You can rewrite a function in the body (or do not write it ):
Program code
<Script language = "javascript">
Function trace (str ){
G. flashDebug. trace (str );
}
</Script>
3. Write a global static method in flash and replace the trace method with global. traceStr during debugging:
Program code
Public class global {
Import flash. external. ExternalInterface;
Public static function traceStr (str: String): void {
Trace (str); // outputs debugging information in the flash environment;
If (ExternalInterface. available ){
ExternalInterface. call ("trace", str); // output debugging information on the webpage;
}
}
}
The following is an example:
Because this is the result displayed in the new window, you can use jdhcn. the content in the js file is like html. run trace ("test jdhcn. flash debug ") to simulate the flash method call.
<Head> <title> test jdhcn. flashDebug </title> </pead> <body>
[Ctrl + A select all Note: If you need to introduce external Js, You need to refresh it to execute]