Buscador
YoReparo.com La Web 

Regístrate gratis para participar de los foros, o si ya estás registrado haz login.

sistema de noticias flash ayuda!!!

comentario del autor Mie Sep 12, 2007 9:14 pm
   
Quisiera ver si alguien me puede decir por q no anda esto.Lo revise varias veces...

Me lei todo sobre las funciones, puse los campos con los nombres correspondientes...

El .swf tiene 8 campos del tipo namecode y abajo vacio namecode_output para el ingreso de datos.

Tiene 2 tipos de botones; siguiente y anterior.Y otro de delete y save

Son 3 archivos:

  • .swf
  • .xml
  • .php



El Action Script

Cita:// --- variables ---
var xml_file:String = "calendar.xml";
var GUARDA_DATA:String = "news_save.php";
var actualRecord:Number = 0;
var i:Number = 0;
// --- seteando codigo de nuevas entradas ---
/*
var fecha:Date = new Date();
var anio:Number = fecha.getFullYear();
var mes:Number = fecha.getMonth()+1;
var dia:Number = fecha.getDate();
function padNum(num:Number):String {
return num<10 ? "0"+num : num;
}
var codigo:String = anio+padNum(mes)+padNum(dia);
*/
// --- funciones ---
function GetEntry(news_xml:XML, index:Number):XMLNode {
var entries = news_xml.firstChild.childNodes;
return entries[index];
}
function EditNewsEntry(news_xml:XML, node_index:Number, titulo:String, lugar:String, fecha:String):Void {
var entry:XMLNode = GetEntry(news_xml, node_index);
entry.attributes.mifecha = fecha;
entry.attributes.mitexto = lugar;
entry.attributes.mititulo = titulo;
}
function SaveNews(news_xml:XML):Void {
//arregla el bug de duplicacion
news_xml.xmlDecl = "jajajaja";
news_xml.sendAndLoad(GUARDA_DATA, news_xml);
}
function RefreshNews(news_xml:XML):Void {
news_xml.load(xml_file)+"?"+new Date().getTime();
}
// --- cargando el xml ---
var news_xml:XML = new XML();
news_xml.ignoreWhite = true;
news_xml.onLoad = function(succes) {
if (succes) {
totalRecords = this.firstChild.childNodes.length-1;
recordSet.text = (actualRecord+1)+"/"+(totalRecords+1);
anterior_btn.enabled = false;
anterior_btn._alpha = 50;
loadNew(news_xml);
} else {
trace("XML no cargo!");
}
};
RefreshNews(news_xml);
function loadNew(xmlObj:XML, indice:Number):Void {
this = xmlObj;
if (indice) {
i = indice;
} else {
i = actualRecord;
}
recordSet.text = (actualRecord+1)+"/"+(totalRecords+1);
if ((actualRecord+1) == (totalRecords+1)) {
siguiente_btn.enabled = false;
siguiente_btn._alpha = 50;
} else {
siguiente_btn.enabled = true;
siguiente_btn._alpha = 100;
}
if ((actualRecord+1) == 1) {
anterior_btn.enabled = false;
anterior_btn._alpha = 50;
} else {
anterior_btn.enabled = true;
anterior_btn._alpha = 100;
}
namecode.text = this.firstChild.childNodes[i].attributes.micodigo;
nameevento.text = this.firstChild.childNodes[i].attributes.mititulo;
namelugar.text = this.firstChild.childNodes[i].attributes.mitexto;
namefecha.text = this.firstChild.childNodes[i].attributes.mifecha;


}
// --- botones ---
siguiente_btn.onRelease = function() {
if (actualRecord<totalRecords) {
actualRecord++;
loadNew(news_xml, actualRecord);
}
};
anterior_btn.onRelease = function() {
if (actualRecord>0) {
actualRecord--;
loadNew(news_xml, actualRecord);
}
};
save_btn.onRelease = function() {
EditNewsEntry(news_xml, actualRecord, nameevento_output.text, namelugar_output.text, namefecha_output.text);
SaveNews(news_xml);
};
borrar_btn.onPress = function() {
namecode.text = "";
namefecha.text = "";
nameevento.text = "";
namelugar.text = "";
};


Ahora el XML
Cita:<?xml version="1.0"?>
<news>

<entry micodigo="20070329"
mititulo="Paradiso"
mitexto="Lezama Lima"
mifecha="Thursday, March 29, 2007"
/>
<entry micodigo="20070413"
mititulo="El Siglo de las Luces"
mitexto="Alejo Carpentier"
mifecha="Friday, April 13, 2007"
/>
<entry micodigo="20070305"
mititulo="Cuentos"
mitexto="Onelio Jorge Cardoso"
mifecha="Monday, March 5, 2007"
/>

</news>


Ahora el PHP

Cita:<?php
$filename = "calendar.xml";
$raw_xml = file_get_contents("php://input"); //php://input

print $raw_xml;

$fp = fopen($filename, "w");
fwrite($fp, $raw_xml);
fclose($fp);
?>


Pero no puedo hacer que el .swf guarde los nuevos datos en el XML.
Espero puedan ayudarme a encotrar el error...

eybel

Reputación

sin valorar Jue Feb 14, 2008 2:13 pm
   
Saludos, amigo he visto que colocaste un post
solicitando un sistema de noticias en flash y php, bueno
tengo uno listo para usar , con panel de administracion
puedes probarlo entrando en
http://www.ventics.com/portafolio/scripts/sistemadenoticias/
al dar click en Administrar noticias puedes entrar en el panel
este script lo vendo con todo el codigo fuente
en 150 dolares o 105 euros, si estar interesando
contactamente o compralo a traves de mi tienda online
www.ventics.com/shop puedes pagarlo con tarjeta de credito
a traves de paypal

ventics

Reputación



Hacer una pregunta

Reglamento / P+F

Foros

Miembros / Expertos