Super SWF Tracker - Use LocalConnection [2004-12-12] (FROM cloud RIA development)

xiaoxiao2021-03-06  49

===================================================== Super SWF tracker- Use localconnection [2004-12-12] yunkai published in AS2

The trace in Flash can only be tracked in the Flash IDE, if you post the SWF to the Internet, you can't see TRACE debugging information, which gives the difficulties brought by developing network flash, there is no good way To solve this problem, no matter where the SWF is released, open a local SWF tracker to receive debug messages, because I tried various methods, from the local object of SharedObject to the remote object to localconnection method Try again (using localconnection is a "secret" found in Breeze addin, I feel that Snow gives me a prompt, discover the "mystery"), use the following classes in the SWF you need to debug:

Class fj.util.jtricracer {

Public static var debug: boolean = true;

Private static var _instance: JTracer;

PRIVATE VAR _LC: LocalConnection;

Private function jtracer () {

THIS._LC = New localconnection ();

THIS._LC.Allowdomain = function (domain: string): boolean {

Return True;

}

}

Public Static Function Trace (MSG: Object): void {

IF (! jtracer.debug) {

Return;

}

IF (jtracer._instance == undefined) {

JTracer._instance = new jtracer ();

}

JTracer._instance.tracemsg (msg);

}

Private function tracemsg (msg: object): void {

Trace (MSG);

THIS._LC.SEND ("Localhost: Trace", "Trace", this._lc.domain (), msg);

}

}

It is very simple to use, just JTracer.trace ("I will try!");

The code in the SWF tracker is as follows:

Import fj.util.jdelegate;

Class view.jdebug {

PRIVATE VAR _UI: MOVIECLIP;

PRIVATE VAR _LC: LocalConnection;

Function JDEBUG (UI) {

THIS._UI = UI;

this.init ();

}

Private function init () {

THIS._LC = New localconnection ();

THIS._LC.Allowdomain = function (domain): boolean {

Return True;

}

THIS._LC.CONNECT ("trace");

THIS._LC.TRACE = JDELEGATE.CREATE (this, office);}

Private function ontrace (domain: string, msg: object) {

THIS._UI.MSG_TA.TEXT = Domain ":" msg "/ n";

}

}

This requires a component Textarea name called MSG_TA to display the tracked message!

==================================================== Original address

http://www.5dblog.com/vip/yunkai/index.asp?id=37742

转载请注明原文地址:https://www.9cbs.com/read-79727.html

New Post(0)