详细内容
Flash课件制作中A与B之间的通讯技巧
Flash课件制作中A与B之间的通讯技巧
在第一个flash a.swf中
stop();
var loaded_a = 50;
var conn_a = new LocalConnection();
conn_a.trace_b = function(param) {
show_a.text = "b加载="+param+"%";
};
conn_a.connect("loadB");
this.onEnterFrame = function() {
loaded_a += 1
conn_a.send("loadA", "trace_a", loaded_a);
if (loaded_a>=100) {
delete this.onEnterFrame;
}
};
第二个flash b.swf中
stop();
var loaded_b = 20
var conn_b = new LocalConnection();
conn_b.trace_a = function(param) {
show_b.text = "a加载="+param+"%";
};
conn_b.connect("loadA");
this.onEnterFrame = function() {
loaded_b += 1
conn_b.send("loadB", "trace_b", loaded_b);
if (loaded_b>=100) {
delete this.onEnterFrame;
}
};
效果