Comunidad de diseño web y desarrollo en internet online

flash-xml actualizar

Citar            
MensajeEscrito el 12 May 2009 08:47 pm
Mi problema inicial...no recarga la xml automaticamente.
El siguiente es que no hace la lista cuando la publico en HTML, la lista funciona solo como fichero-swf.
Eso...si me pueden ayudar..por favor

[code]
// import this so it can be used to set the scope of the combobox listener and the xml onload routine
import mx.utils.Delegate;

// declare variables
var people:Array;
var update:String;
var dirpath:String;

// create a new color object to associate with the bgcolor movieclip
var bgcol:Color;

// set up the XML instance
var peoplexml:XML = new XML();

// initialize items on stage
_global.style.setStyle("fontFamily", "Verdana");
_global.style.setStyle("fontSize", 11);

// define what should happen when the XML loads
// (read data into update, dirpath, and people variables)
function onXmlLoaded(success:Boolean) {
if (success) {
// make a handle to the root node in the xml
var mainnode:XMLNode = peoplexml.firstChild;
update = mainnode.attributes.lastupdate;
dirpath = mainnode.attributes.dir;

// set up an array of all person nodes
var peoplenodes:Array = peoplexml.firstChild.childNodes;
for (var i:Number = 0; i < peoplenodes.length; i++) {
// for each person node:
var personnode:XMLNode = peoplenodes[i];
people.push(
{i:i+1,
pname:personnode.attributes.name,
bgcolor:parseInt(personnode.attributes.bgcolor, 16),
photo:personnode.attributes.photo,
// bgswf:personnode.childNodes[0].attributes.url,
desc:personnode.childNodes[0].firstChild.nodeValue,
resumen:personnode.childNodes[2].firstChild.nodeValue,
note:personnode.childNodes[1].firstChild.nodeValue,
links:personnode.childNodes[3].firstChild.nodeValue
});
}
// data is all read and put in the right place -- now setup the screen
// using this data
setup();
} else {
trace('error reading XML');
}
}

function setup() {
// set up chooseperson dropdown
chooseperson.labelField = "pname";
chooseperson.dataProvider = people;
chooseperson.addEventListener("change", Delegate.create(this, loadScreen));
}

function loadScreen(evt:Object) {
var thisitem:Object = evt.target.selectedItem;
ta.text = thisitem.desc;
ta2.text = thisitem.resumen;
ta3.text = thisitem.note;
ta.vPosition = 0;
bgcol.setRGB(thisitem.bgcolor);
}

function init() {
// initialize the people array
people = [{pname:"Choose one"}];

// set up the xml instance to ignore whitespace between tags
peoplexml.ignoreWhite = true;

// set the scope of the onLoad function to the main timeline, not peoplexml
peoplexml.onLoad = Delegate.create(this, onXmlLoaded);

// initialize the bgcol color variable by associating it with the background movieclip
bgcol = new Color(bgcolor);


var rand:Number = Math.round(Math.random() * 2);


//peoplexml.load("daten/bernd.xml"+"?rand=" + rand);
peoplexml.load("daten/bernd.xml");
}

init();



[/code]

Por estudiosa

23 de clabLevel



 

Alemania

firefox
Citar            
MensajeEscrito el 13 May 2009 09:12 pm
Lo primero, es que debes poner un mayor número de random, si pones solamente 2 las posibilidades de que se repita son 50%

debes poner algo como:

Código ActionScript :

var rand:Number = Math.round(Math.random() * 999999);
peoplexml.load("daten/bernd.xml?rand=" + rand); //---Elimina la suma de strings es lo mismo que ponerlos juntos


En cuanto al segundo punto, lo más probable es que el camino que utilizas para leer tus archivos externos cambie cuando lo llevas a html, como es la estructura de tus swf con respecto al html?

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 14 May 2009 12:09 am
Si pongo 2 o si pongo 99999 me da el error :

Fehler beim Öffnen der URL 'file:///C/peopledisplay/daten/bernd.xml?rand=318831'
error reading XML

eso ya no lo puedo usar así.


Lo segundo no sé que opinas con estructura de Html.
En la publicación está previsto que haga también html, pero el combobox no muestra los datos.

Quizás con estos datos me pueden ayudar más?

Gracias

Por estudiosa

23 de clabLevel



 

Alemania

firefox
Citar            
MensajeEscrito el 16 May 2009 12:35 am
Esto significa que estás leyendo el XML en local:

'file:///C/peopledisplay/daten/bernd.xml?rand=318831'
y el código está realizado para que lea de un servidor que es donde tienes el problema, aunque te de el error de que no encuentra el archivo, pruébalo desde el servidor y no te dará problemas porque no creará caché.

Ahora cuando dices que no te muestra los datos el comboBox lo estás probando en local también? o has hecho la prueba desde el servidor.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 16 May 2009 06:16 am
Aunque lo puse en el servidor, no funciona, puesto que el combobox no muestra datos.
Esa es la primera problemática.

Quizás tengo que partir por ahí, pero cómo?

Por estudiosa

23 de clabLevel



 

Alemania

firefox
Citar            
MensajeEscrito el 16 May 2009 08:19 am
Ahora descubrí el problema, tenía dos imágenes demás en components, y eso producía el problema de la lista.:-))

Ahora funciona perfectamente, sólo que cada vez que reactualizo la xml, tengo que hacer F5 para reactualizar a mano el cache del browser. Pero me imagino que eso es así. O?

Muchas gracias

Por estudiosa

23 de clabLevel



 

Alemania

firefox
Citar            
MensajeEscrito el 16 May 2009 10:46 am
Si, es normal que tengas que actualizar la página, no te preocupes.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 16 May 2009 11:01 am
Que alivio, bueno y la siguiente pregunta es ...cómo se hace para gravar datos en xml sin pasar por el banco de datos.
Digo si hago un formulario que grave los datos recién dados por el usuario.

Si existe esa posibilidad sería super.

Muchas gracias de antemano

Por estudiosa

23 de clabLevel



 

Alemania

firefox
Citar            
MensajeEscrito el 16 May 2009 04:20 pm
Creando un php o un asp que cree el fichero html y lo salve en la ubicación correcta.

Por elchininet

Claber

3921 de clabLevel

17 tutoriales

Genero:Masculino  

Front-end developer at Booking.com

firefox
Citar            
MensajeEscrito el 16 May 2009 05:07 pm
gracias,

ahora ando buscando algún ejemplo. Pero eso es lo que necesito.
Por el momento eso sería.
Gr nuevamente

Por estudiosa

23 de clabLevel



 

Alemania

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.