import mx.data.components.WebServiceConnector;
//设置webservice服务地址
var strSerUrl:String = "http://book.ievt.cn/ServiceBook.asmx?WSDL";
//提交流言
_root.submit_btn.onRelease = function() {
var strNickName:String = _root.nickname_txt.text;
var strTitle:String = _root.title_txt.text;
var strContent:String = _root.content_txt.text;
if (strNickName != "" && strTitle != "" && strContent != "") {
//trace("yes");
var wscListener:Object = new Object();
wscListener.result = function(evt:Object) {
//trace(evt.target.results);
ShowBook(0,7);
_root.nickname_txt.text = "";
_root.title_txt.text = "";
_root.content_txt.text = "";
LoadSWF();
};
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("result",wscListener);
wsConn.WSDLURL = strSerUrl;
wsConn.operation = "CreateBook";
wsConn.params = [strNickName, strTitle, strContent];
wsConn.trigger();
} else {
if (strNickName == "") {
_root.x1_mc._visible = true;
} else {
_root.x1_mc._visible = false;
}
if (strTitle == "") {
_root.x2_mc._visible = true;
} else {
_root.x2_mc._visible = false;
}
if (strContent == "") {
_root.x3_mc._visible = true;
} else {
_root.x3_mc._visible = false;
}
}
};
//刷新流言
_root.Renovates_btn.onRelease = function() {
ShowBook(0,7);
};
//显示留言
function ShowBook(firstnum, pagesize) {
var wscListener:Object = new Object();
wscListener.result = function(evt:Object) {
//trace(evt.target.results);
FormatBookMessage(evt.target.results);
_root.load_mc.play();
};
var wsConn:WebServiceConnector = new WebServiceConnector();
wsConn.addEventListener("result",wscListener);
wsConn.WSDLURL = strSerUrl;
wsConn.operation = "GetBook";
wsConn.params = [firstnum, pagesize];
wsConn.trigger();
}
//格式化留言信息
function FormatBookMessage(bookmessage_str) {
var Message_array = bookmessage_str.split("★");
for (i=1; i<8; i++) {
//trace(Message_array[i]);
//trace(_root["txt"+(i-1)+"_mc"]);
if (Message_array[i] == undefined) {
Message_array[i] = "●●●";
}
WriteMC(_root["txt"+(i-1)+"_mc"],Message_array[i]);
}
function WriteMC(obj, item_str) {
var item_array = item_str.split("●");
obj.nickname_txt.text = item_array[0];
obj.title_txt.text = item_array[1];
obj.content_txt.text = item_array[2];
obj.date_txt.text = item_array[3];
}
}
//翻页
_root.b1_btn.onRelease = function() {
ShowBook(0,7);
};
_root.b2_btn.onRelease = function() {
ShowBook(8,7);
};
_root.b3_btn.onRelease = function() {
ShowBook(15,7);
};
_root.b4_btn.onRelease = function() {
ShowBook(22,7);
};
_root.b5_btn.onRelease = function() {
ShowBook(29,7);
};
_root.b6_btn.onRelease = function() {
ShowBook(36,7);
};
_root.b7_btn.onRelease = function() {
ShowBook(43,7);
};
_root.b8_btn.onRelease = function() {
ShowBook(50,7);
};
//初始化
ShowBook(0,7);
LoadSWF();
function LoadSWF() {
_root.x1_mc._visible = false;
_root.x2_mc._visible = false;
_root.x3_mc._visible = false;
}