Home >Web Front-end >JS Tutorial >js class for viewing flash trace data on a web page_javascript skills
Function:
Call some methods of flash to see the data output by the trace method of flash in the web page;
Method:
1. init(w,h,z);//w is the display interface Width, h is the height of the display interface, z is the level (preferably placed at the top level);
2. trace(str);//Data to be output;
Use :
1. Import jdhcn.js, Click to download jdhcn.js
2. You can rewrite a function in the body (or not):
Program code
3. In 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);//Output debugging information in the flash environment;
if(ExternalInterface.available){
ExternalInterface.call("trace", str);//Output debugging information under the web page;
}
}
}
The following is an example:
Because this is a new window pop-up to see the effect, so I put the jdhcn.js file The content is generally in HTML. Execute trace("Test jdhcn.flashDebug") to simulate that it is called through the flash method.