En primer lugar saludos a todos, ya que soy nuevo en el foro
Se que se cree que se ha hablado de esto pero sinceramente le he dado mil y una vueltas y esto no esta completo .. Yo soy diseñador flash y mis conocimientos de programación son cortitos, estoy intentando empaparme de todo pero estoy limitado
Hace unos días cree una web donde tiene un apartado de noticias que carga un xml mediante php pudiendo crear todas las noticias nuevas que quisiera …
Asta hay genial ¡
Lo q me esta quitando el sueño es que quiero poder modificar dichas noticias ampliarlas o borrarlas desde el espacio de administrador no se como hacerlo no se si con el xml puedo hacerlo o tendría que coger otro formato y si es así como lo enlazo a el flash que contiene mi pagina?
Archivos actuales :
Flash: que contiene la pelicula y el espacio administrador + recojida de datos
//AactionScript 2
System.useCodepage = true;
var currPage = 0;
var showAmount = 10;
// cantidad de entradas que desea ver a la vez
previous._visible = false;
createMessage._visible = false;
createButton.onRelease = function() {
this._visible = false;
this._parent.createMessage._visible = true;
if (createMessage.nameField.text == "") {
Selection.setFocus(createMessage.nameField);
} else if (createMessage.messageField.text == "") {
Selection.setFocus(createMessage.messageField);
}
};
// **** 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 lectura 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.closeButton.onRelease = function() {
this._parent._visible = false;
createButton._visible = true;
};
createMessage.sendButton.onRelease = function() {
var myName = this._parent.nameField.text;
var myMessage = this._parent.messageField.text;
if (myName == "") {
this._parent.errorField.text = "falta titulo";
Selection.setFocus(this._parent.nameField);
} else if (myMessage == "") {
this._parent.errorField.text = "falta contenido";
Selection.setFocus(this._parent.messageField);
} 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._visible = false;
createButton._visible = true;
}
};
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 = numItems+" Noticias: ";
if (firstItem == lastItem+1) {
nowShowing.text = "Noticias Mostradas "+firstItem;
} else {
nowShowing.text = "Noticias Mostradas "+firstItem+" to "+(lastItem+1);
}
for (i=(firstItem-1); i>=lastItem; i--) {
myGuestbook.htmlText += "<B>"+this.firstChild.childNodes[i].attributes.myName+"</B> \n";
myGuestbook.htmlText += this.firstChild.childNodes[i].firstChild.firstChild.nodeValue+"\n\n";
}
};
previous.onRelease = function() {
currPage--;
myXML.showXML();
next._visible = true;
};
next.onRelease = function() {
currPage++;
myXML.showXML();
previous._visible = true;
};
Archivo php : (processXML.php)
tipo guestbook que hace de enlace o motor del xml a flash
//codigo
<?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."\n";
fclose($file);
?>
Archivo xml( guestbook.xml)
//codigo
<?xml version="1.0"?><guestbook><entry myName=""><myText>. </myText></entry></guestbook>
