This article is mainly about the production of Flash message board and provide Flash message board source files and asp+flash message Board The ultimate goal is to let you use the flash to make a message board well, first look at the message page Picture it.
Now to see the flash file inside the ActionScript first frame action
Stop ();
var loadlv:loadvars = new Loadvars ();
Tijiao.onrelease = function () {
if (Nichen_txt = = "" | | Liouyan_txt.text = = "") {
Xianshi_txt.text = "What is called or message content can not be empty";
} else {
Loadlv.username = Nichen_txt.text;
Loadlv.word = Liouyan_txt.text;
Loadlv.sendandload ("http://127.0.0.1/liouyan.asp", LOADLV, "post");
}
};
Removetip.onrelease = function () {
Nichen_txt.text = "";
Liouyan_txt.text = "";
};
Xianshi.onrelease=function () {
gotoAndStop (2);
}
Loadlv.onload = function (Success:boolean) {
if (success) {
Nichen_txt.text = "";
Liouyan_txt.text = "";
Xianshi_txt.text = this.username+ "Say" +this.word;
} else {
Trace ("Load failed");
}
};
The first frame of the code is mainly used to message verification I think you should understand, we now look at the second frame code.
Stop ();
var maxnum:number = 5;
var num:number = 1;
prev_btn.enabled = false;
Next_btn.enabled = true;
var userarray:array = new Array ();
var infoarray:array = new Array ();
var myxml:xml = new XML ();
Myxml.ignorewhite = true;
Myxml.onload = function (Success:boolean) {
if (success) {
var root:xmlnode = This.firstchild;
for (var i = 0; i<root.childnodes.length; i++) {
Userarray.push (Root.childnodes[i].firstchild.firstchild);
Infoarray.push (Root.childnodes[i].lastchild.firstchild);
}
for (var i = maxnum* (num-1); i<maxnum*num; i++) {
_root["Mytextarea" +i%maxnum].text = "nickname" +userarray[i]+ "published a message, the content is" +infoarray[i ";
}
} else {
Mytextarea.text = "Error";
}
};
Myxml.load ("http://127.0.0.1/xmlxianshi.asp");
Prev_btn.onrelease = function () {
num = num-1;
Next_btn.enabled = true;
if (num>=0) {
for (var i = maxnum* (num-1); i<maxnum*num; i++) {
_root["Mytextarea" +i%maxnum].text = "nickname" +userarray[i]+ "published a message, the content is" +infoarray[i ";
}
} else {
prev_btn.enabled = false;
}
};
Next_btn.onrelease = function () {
num = num+1;
Prev_btn.enabled = true;
if (maxnum*num<userarray.length) {
for (var i = maxnum* (num-1); i<maxnum*num; i++) {
_root["Mytextarea" +i%maxnum].text = "nickname" +userarray[i]+ "published a message, the content is" +infoarray[i ";
}
else if (maxnum*num>userarray.length) {
for (Var j=0;j<5;j++) {
_root["Mytextarea" +j].text = "";
}
for (var i = maxnum* (num-1); i<userarray.length; i++) {
_root["Mytextarea" +i%maxnum].text = "nickname" +userarray[i]+ "published a message, the content is" +infoarray[i ";
}
next_btn.enabled = false;
} else {
next_btn.enabled = false;
}
};
This is mainly to analyze the XML file and send the data to your ASP file to save to the database