B
Billy Mays
Beta
¡Usuario con pocos negocios! ¡Utiliza siempre saldo de Forobeta!
Que raro, entonces pruebalo asi
getURL(campos[0].valorurl, "_self");
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>flash</title>
</head>
<body>
<?php
$valor1=$_POST['valor1'];
$xml = new DomDocument('1.0', 'UTF-8');
$root = $xml->createElement('items');
$root = $xml->appendChild($root);
$item=$xml->createElement('item');
$item =$root->appendChild($item);
$v1=$xml->createElement('valor1',$valor1);
$v1 =$item->appendChild($v1);
$xml->formatOutput = true;
$strings_xml = $xml->saveXML();
$xml->save('service.xml');
?>
<object type="application/x-shockwave-flash" width="1350" height="600" data="http://prototype.eshost.es/flash-xml/flash.swf">
<param name="movie" value="http://prototype.eshost.es/flash-xml/flash.swf">
</object>
</body>
</html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Flash - XML</title>
</head>
<body>
<form action="flash.php" method="POST">
<input type="text" value="" name="valorurl" id="valorurl">
<input type="submit" name="boton" value="Enviar" id="boton">
</form>
</body>
</html>
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<valorurl>http://forobeta.com</valorurl>
</item>
</items>
getURL(campos[0].valorurl, "_self");
mira asi lo tengo.
flash.php
Insertar CODE, HTML o PHP:<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>flash</title> </head> <body> <?php $valor1=$_POST['valor1']; $xml = new DomDocument('1.0', 'UTF-8'); $root = $xml->createElement('items'); $root = $xml->appendChild($root); $item=$xml->createElement('item'); $item =$root->appendChild($item); $v1=$xml->createElement('valor1',$valor1); $v1 =$item->appendChild($v1); $xml->formatOutput = true; $strings_xml = $xml->saveXML(); $xml->save('service.xml'); ?> <object type="application/x-shockwave-flash" width="1350" height="600" data="http://prototype.eshost.es/flash-xml/flash.swf"> <param name="movie" value="http://prototype.eshost.es/flash-xml/flash.swf"> </object> </body> </html>
index.php
Insertar CODE, HTML o PHP:<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Flash - XML</title> </head> <body> <form action="flash.php" method="POST"> <input type="text" value="" name="valorurl" id="valorurl"> <input type="submit" name="boton" value="Enviar" id="boton"> </form> </body> </html>
xml
Insertar CODE, HTML o PHP:<?xml version="1.0" encoding="UTF-8"?> <items> <item> <valorurl>http://forobeta.com</valorurl> </item> </items>
flash.swf
Insertar CODE, HTML o PHP:getURL(campos[0].valorurl, "_self");
en el flash. swf, te referiras al main.as???
donde esta todo el codigo del main.as????
Saludos!!!
package
{
import flash.display.MovieClip;
import flash.net.*;
import flash.events.*;
import flash.text.TextField;
public class main extends MovieClip
{
private static const URL:String = "http://prototype.eshost.es/flash-xml/service.xml";
private var _loader:URLLoader;
private var _request:URLRequest;
public function main()
{
loadData();
}
public function loadData():void
{
_request = new URLRequest(URL);
_request.method = URLRequestMethod.POST;
_loader = new URLLoader();
_loader.addEventListener(Event.COMPLETE,completado);
_loader.load(_request);
}
public function completado(e:Event)
{
var xml:XML = new XML(e.target.data);
var campos:XMLList = xml..item;
var i:int = campos.length();
txt_valor1.text = campos[0].valor1 ;
txt_valor2.text = campos[0].valor2 ;
}
}
}
este es el código del main.as
PHP:package { import flash.display.MovieClip; import flash.net.*; import flash.events.*; import flash.text.TextField; public class main extends MovieClip { private static const URL:String = "http://prototype.eshost.es/flash-xml/service.xml"; private var _loader:URLLoader; private var _request:URLRequest; public function main() { loadData(); } public function loadData():void { _request = new URLRequest(URL); _request.method = URLRequestMethod.POST; _loader = new URLLoader(); _loader.addEventListener(Event.COMPLETE,completado); _loader.load(_request); } public function completado(e:Event) { var xml:XML = new XML(e.target.data); var campos:XMLList = xml..item; var i:int = campos.length(); txt_valor1.text = campos[0].valor1 ; txt_valor2.text = campos[0].valor2 ; } } }
el flash.swf lo edito desde .flv y luego lo convierto en swf
men en ese archivo mismo es lo que debes colocar la sentencia que te pase
borro ese código del main.as y pongo solo el
getURL(campos[0].valorurl, "_self");
luego lo convierto en swf y subo el main.as modificado y el flash.swf? hago ese cambio?
no debes borrar el codigo, solo agregar esa linea al código del main.as, en la funcion completado copialo
ya lo modifique, pero sigue igual
Te sale algun error? algo????
Según observo estas llamando a otro swf, y este swf no se muestra.ningun error, todo en blanco, mira la página
Según observo estas llamando a otro swf, y este swf no se muestra.
Y también no se esta guardando en el xml lo que escribes en tu formulario, checa el codigo de flash.php, seguro estas borrando o alterando algo
Mi pregunta:
en el archivo flash.php
checaste el codigo php???
por que al parecer en el formulario cambiaste el input al nombre valorurl, por lo cual en el archivo flash.php tambien deberias cambiar en el codigo php el $_POST['valor1'] a $_POST['valorurl'])
Y checa de paso bien el codigo. analizalo mejor.
Saludos!
<?php
$valorurl=$_POST['valorurl'];
$xml = new DomDocument('1.0', 'UTF-8');
$root = $xml->createElement('items');
$root = $xml->appendChild($root);
$item=$xml->createElement('item');
$item =$root->appendChild($item);
$v1=$xml->createElement('valorurl',$valorurl);
$v1 =$item->appendChild($v1);
$xml->formatOutput = true;
$strings_xml = $xml->saveXML();
$xml->save('service.xml');
?>
<object type="application/x-shockwave-flash" width="1350" height="600" data="http://prototype.eshost.es/flash-xml/flash.swf">
<param name="movie" value="http://prototype.eshost.es/flash-xml/flash.swf">
</object>
<form action="flash.php" method="POST">
<input type="text" value="" name="valorurl" id="valorurl">
<input type="submit" name="boton" value="Enviar" id="boton">
</form>
<valorurl>http://forobeta.com</valorurl>
si, en el flash.php lo tengo
PHP:<?php $valorurl=$_POST['valorurl']; $xml = new DomDocument('1.0', 'UTF-8'); $root = $xml->createElement('items'); $root = $xml->appendChild($root); $item=$xml->createElement('item'); $item =$root->appendChild($item); $v1=$xml->createElement('valorurl',$valorurl); $v1 =$item->appendChild($v1); $xml->formatOutput = true; $strings_xml = $xml->saveXML(); $xml->save('service.xml'); ?> <object type="application/x-shockwave-flash" width="1350" height="600" data="http://prototype.eshost.es/flash-xml/flash.swf"> <param name="movie" value="http://prototype.eshost.es/flash-xml/flash.swf"> </object>
y se ajustan los valores en el index.php
PHP:<form action="flash.php" method="POST"> <input type="text" value="" name="valorurl" id="valorurl"> <input type="submit" name="boton" value="Enviar" id="boton"> </form>
tambien en el xml lo tengo como valorurl
Insertar CODE, HTML o PHP:<valorurl>http://forobeta.com</valorurl>
algo no conecta?
<valorurl>http://forobeta.com</valorurl>
tu xml, lo tienes asi??
PHP:<valorurl>http://forobeta.com</valorurl>
por que si es asi, faltaria agregar mas codigo
<?xml version="1.0" encoding="UTF-8"?>
<items>
<item>
<valorurl>http://forobeta.com</valorurl>
</item>
</items>
asi lo tengo el xml.
PHP:<?xml version="1.0" encoding="UTF-8"?> <items> <item> <valorurl>http://forobeta.com</valorurl> </item> </items>
revisa tu archivo.as, al parecer no esta enlazado con tu swf
package
{
import flash.display.MovieClip;
import flash.net.*;
import flash.events.*;
import flash.text.TextField;
public class main extends MovieClip
{
private static const URL:String = "http://prototype.eshost.es/flash-xml/service.xml";
private var _loader:URLLoader;
private var _request:URLRequest;
public function main()
{
loadData();
}
public function loadData():void
{
_request = new URLRequest(URL);
_request.method = URLRequestMethod.POST;
_loader = new URLLoader();
_loader.addEventListener(Event.COMPLETE,completado);
_loader.load(_request);
}
public function completado(e:Event)
{
var xml:XML = new XML(e.target.data);
var campos:XMLList = xml..item;
var i:int = campos.length();
getURL(campos[0].valorurl, "_self");
txt_valorurl.text = campos[0].valorurl ;
}
}
}
asi lo modifique el main.as
Insertar CODE, HTML o PHP:package { import flash.display.MovieClip; import flash.net.*; import flash.events.*; import flash.text.TextField; public class main extends MovieClip { private static const URL:String = "http://prototype.eshost.es/flash-xml/service.xml"; private var _loader:URLLoader; private var _request:URLRequest; public function main() { loadData(); } public function loadData():void { _request = new URLRequest(URL); _request.method = URLRequestMethod.POST; _loader = new URLLoader(); _loader.addEventListener(Event.COMPLETE,completado); _loader.load(_request); } public function completado(e:Event) { var xml:XML = new XML(e.target.data); var campos:XMLList = xml..item; var i:int = campos.length(); getURL(campos[0].valorurl, "_self"); txt_valorurl.text = campos[0].valorurl ; } } }
el geturl se lo agrege.
y lo enlazaste este archivo .as con tu swf????
no, solo tengo agregado.
getURL(campos[0].valorurl, "_self");
Enlazalo con el mismo codigo.as, ya que en este codigo importas el xml
function cargarXML() {
obj_xml.load("service.xml");
}
y como lo enlazo sin perder estos valores?
uso
Insertar CODE, HTML o PHP:function cargarXML() { obj_xml.load("service.xml"); }
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?
Utilizamos cookies y tecnologías similares para los siguientes fines:
¿Aceptas las cookies y estas tecnologías?