代理类由包括3个部分~以LocalConnection作为基类,主体是一个由2.0写的一个AgencySWF类~主要用于连接2.0代理类(ClientAgencySWF_2)实例或3.0代理类(ClientAgencySWF)并兼担共享数据存处的载体~
AgencySWF类
class AgencySWF extends LocalConnection {
private var conName = 'agencySWF';
private var $$sending_lc;
public var text;
public var Trace_Bool;
private var Member_ID;
private var txt;
//private var _root.SO:SharedObject;
public function AgencySWF(link) {
var obj = {MP3UrlArr:[], MP3NameArr:[], ArtistArr:[], MoodArr:[], MP3InfoArr:[]};
var arr = ["我是共享对象","我是共享对象","我是共享对象","我是共享对象"];
// var arr=[obj,obj,obj,obj];
_root.SO = SharedObject.getLocal("AgencySo");
_root.SO.data.cookie == undefined ? _root.SO.data.cookie=arr : '';
_root.SO.data.cookie = arr;
;
if (link != undefined) {
conName = link;
}
$$sending_lc = this;
this.$$sending_lc.connect(conName);
this.$$sending_lc.onStatus = function(infoObject:Object) {
switch (infoObject.level) {
case 'status' :
;
trace(" 中介 回调 成功 ");
break;
case 'error' :
trace("LocalConnection encountered an error.");
break;
}
};
}
//获取用户id
private function setimd(arg) {
trace(arg.imd);
Member_ID = arg.imd;
text = "Member_ID="+Member_ID;
return Member_ID;
}
private function getimd(arg) {
trace("call child success");
return Member_ID;
}
//调用外部接口
public function SendFunc(func, res) {
$$sending_lc.send("agencySWF","agencyFunc",conName,func,res);
}
//外部调用接口 (外部连接名,调用本类的函数,参数)
public function agencyFunc(callconnet, callfunc, callinfo) {
text = "";
var _l3 = {imd:_root.Member_ID, info:callinfo};
if (Trace_Bool) {
trace("------呼叫中介函数成功------");
trace("ReConnect::"+callconnet+" Func::"+callfunc);
text = _root.txt.text+"ReConnect::"+callconnet+" Func::"+callfunc;
trace(" arguments::");
for (var i in _13) {
trace(i+'=='+_13[i]);
}
}
$$sending_lc.send(callconnet,callfunc,_l3);
}
//外部接口函数 (外部连接名,要调用的本类方法,参数)
public function callAgencyFunc(callConnet, callFunc, callInfo) {
trace("AgencySWF Get ["+callConnet+"] Call Success");
var Result = {imd:Menber_ID, Info:this[callFunc](callInfo)};
$$sending_lc.send(callConnet,callFunc,Result);
}
//调试开关
private function Trace(bool) {
$$sending_lc.send("agencySWF","setTrace");
}
//创建shareObject属性
private function createShareObject(varName:String, newVar) {
_root.SO.data[arguments[0]] == undefined ? my_so.data[arguments[0]]=arguments[1] : '';
return _root.SO.data[arguments[0]];
}
private function getShareObject(arg) {
return _root.SO.data[arg[0]];
}
//设置shareObject属性
private function setShareObject(arg) {
_root.SO.data[arg[0]] = arg[1];;
return _root.SO.data[arg[0]];
}
public function SendMessage(arg) {
trace('sendMessage:'+arguments)
var client_id=arg[0];
var func=arg[1]
arg.shift()
arg.shift()
_root.setConnet(client_id,client_id,func,arg);
//$$sending_lc.send(callConnet,callFunc,Result);
}
}
Word教程网 | Excel教程网 | Dreamweaver教程网 | Fireworks教程网 | PPT教程网 | FLASH教程网 | PS教程网 |
HTML教程网 | DIV CSS教程网 | FLASH AS教程网 | ACCESS教程网 | SQL SERVER教程网 | C语言教程网 | JAVASCRIPT教程网 |
ASP教程网 | ASP.NET教程网 | CorelDraw教程网 |