我的Trace类

      Flash 2005-5-28 15:43:00
其实关于这个早就有人做过了,试着做了一个,效果还行。先写一个类,命名为myTrace,代码为:
class myTrace {
private var my_lc:LocalConnection;
public function myTrace() {
this.my_lc = new LocalConnection();
}
public function Trace(mess:Object) {
this.my_lc.send("ourConnect", "myReceive", mess);
}
public function Clear() {
this.my_lc.send("ourConnect", "myClear");
}
}

写一个测试文件,在第一帧加入以下代码:
newTrace = new myTrace();
for (var i = 0; i<=100; i++) {
newTrace.Trace(i);
}
newTrace.Clear()
用于接收Trace信息的文件中加入以下代码:
my_lc = new LocalConnection();
my_lc.myReceive = function(messFromOthers) {
mess.text += messFromOthers+"\n";
mess.vPosition = mess.maxVPosition;
};
my_lc.myClear = function() {
mess.text = "";
};
my_lc.connect("ourConnect");
以后调试程序的时候就不用那么麻烦了。。
标签集:TAGS:
回复Comments() 点击Count()
喜欢就顶一下

回复Comments

{commentauthor}
{commentauthor}
{commenttime}
{commentnum}
{commentcontent}
作者:
{commentrecontent}
深度XP 雨林木风XP WinXP下载 世界之窗 深度系统 雨林木风 Ghost ghost系统盘 XP下载