I have 2 problems one is a guest book that freeze the flash when sending, and second one is elastic lines, lines and guest book work when i export to flash6 but when i export to flash 7-8 nothing works Can you please help me and do some modifications that will fix those errors i am weak in AS
Guest book AS
var currPage = 0;
var showAmount = 30; // set this to the amount of entries you want to view at a time
previous._visible = false;
// **** Load XML ****************************
myXML = new XML();
myXML.ignoreWhite = true;
receiverXML = new XML();
myXML.onLoad = function(success){
myXML.contentType = "text/xml";
if (success){
this.showXML();
}
else{
trace("Error loading XML file");
}
}
myIdentifier=Math.round(Math.random()*10000);
myXML.load("guestbook.xml?uniq="+myIdentifier);
receiverXML.onLoad = function(){
this.contentType = "text/xml";
_root.currPage = 0;
this.showXML();
}
createMessage.sendButton.onRelease = function(){
var myName = this._parent.nameField.text;
var myMessage = this._parent.messageField.text;
if (myName == ""){
this._parent.errorField.text = "Wpisz swoje imię";
Selection.setFocus(this._parent.nameField);
return;
}
else if (myName == "Imię"){
this._parent.errorField.text = "Wpisz swoje imię";
Selection.setFocus(this._parent.nameField);
return;
}
if (myMessage == ""){
this._parent.errorField.text = "Wpisz wiasomość";
Selection.setFocus(this._parent.messageField);
return;
}
else if (myMessage == "Wiadomość"){
this._parent.errorField.text = "Wpisz wiasomość";
Selection.setFocus(this._parent.messageField);
return;
}
else {
myXML.firstChild.appendChild(myXML.createElement("entry"));
myXML.firstChild.lastChild.attributes.myName = myName;
myXML.firstChild.lastChild.appendChild(myXML.createElement("myText"));
myXML.firstChild.lastChild.lastChild.appendChild(myXML.createTextNode(myMessage));
myXML.sendAndLoad("processXML.php", receiverXML);
this._parent.imie = "";
this._parent.wiadomosc = "";
this._parent.errorField.text = "Dziękuję za wpis do księgi";
}
}
XML.prototype.showXML = function(){
myGuestbook.scroll = 1;
myGuestbook.htmlText = "";
var numItems = this.firstChild.childNodes.length;
var firstItem = numItems - (currPage*showAmount);
if (currPage == 0) previous._visible = false;
var lastItem = firstItem - showAmount ;
if (lastItem<=0) {
lastItem = 0;
next._visible = false;
}
myCount.text = "Suma wpisów: " + numItems;
if (firstItem == lastItem+1) nowShowing.text = "Wiadomości od " + firstItem;
else nowShowing.text = "Wiadomości od " + firstItem + " do " + (lastItem + 1);
for (i=(firstItem-1); i>= lastItem; i--){
myGuestbook.htmlText += "<font color=\"#0875C9\">" + this.firstChild.childNodes*.attributes.myName + "</font>" + " " + "Napisał/a:
";
myGuestbook.htmlText += this.firstChild.childNodes*.firstChild.firstChild.nodeValue + "
";
}
}
previous.onRelease = function(){
currPage--;
myXML.showXML();
next._visible = true;
}
next.onRelease = function(){
currPage++;
myXML.showXML();
previous._visible = true;
}
Guest book PHP
<?php
$file = fopen("guestbook.xml", "w+") or die("Can't open XML file");
$xmlString = $HTTP_RAW_POST_DATA;
if(!fwrite($file, $xmlString)){
print "Error writing to XML-file";
}
print $xmlString."
";
fclose($file);
?>
And Elastic lines
#initclip
LineClass = function () {
};
p = LineClass.prototype=new MovieClip();
p.onLoad = function() {
this.arrMC = [];
this.arrMC.push(this.st);
var i = 1;
while (i<this.num-1) {
this.arrMC.push({n:i++, _parent:this});
}
this.arrMC.push(this.en);
ASSetPropFlags(this, null, 7, 1);
};
//
p.update = function() {
var y = (this._parent.arrMC[this.n-1]._y+this._parent.arrMC[this.n+1]._y+this._parent.weight)/2;
var x = (this._parent.arrMC[this.n-1]._x+this._parent.arrMC[this.n+1]._x)/2;
this._x += this.sx=(this.sx+(x-this._x)/5)*this._parent.elastic;
this._y += this.sy=(this.sy+(y-this._y)/5)*this._parent.elastic;
};
p.onEnterFrame = function() {
this.clear();
this.lineStyle(3, 0x666699, 100);
for (var i = 1; i<this.arrMC.length-1; i++) {
this.update.apply(this.arrMC*);
}
var e, s = this.arrMC[0];
this.moveTo(s._x, s._y);
for (var i = 1; i<this.arrMC.length; i++) {
s = this.arrMC[i-1];
e = this.arrMC*;
var mx = (s._x+e._x)/2;
var my = (s._y+e._y)/2;
this.curveTo(s._x, s._y, mx, my);
}
this.lineTo(e._x, e._y);
};
delete p;
Object.registerClass("lndowntempo", LineClass);
#endinitclip