Salve ragazzi,
devo inserire in un sito flash un testo che venga letto da un file esterno (txt o xml) e che cambi ogni tot ore.
Qualcuno saprebbe indicarmi dove posso trovare uno script simile??
GRAZIE!!!![]()
Salve ragazzi,
devo inserire in un sito flash un testo che venga letto da un file esterno (txt o xml) e che cambi ogni tot ore.
Qualcuno saprebbe indicarmi dove posso trovare uno script simile??
GRAZIE!!!![]()
Di norma l'intervallo di tempo è regolato dalla funzione setInterval espressa in millisecondi....
Un intervallo di ore mi sembra una cosa piuttosto anomala.
si, è piuttosto anomala, ma devo far comparire una frase poetica in un sito, che mi cambi però ogni tot ore, o magari ogni giorno.
Allora conviene tenere sotto controllo la data del giorno con getDate() e dire che se il giorno è tot deve inseerire un determinato testo....
Sapresti indicarmi dove trovare un esempio? Sembrava una cosa da niente e invece non ci salto più fuori!!!![]()
tempo = new Date();
giorno=tempo.getDate();
In questo modo assegni il valore del giorno della variabile "giorno".
A questo punto ti basterà dire:
if(giorno==1){
//comandi per scrivere il testo nel campo testo dinamico al primo giorno dle mese;
}else if(giorno==2){
//comandi per scrivere il testo nel campo testo dinamico al secondo giorno dle mese;
}
e via dicendo....
ok ma tieni presente che ho circa 10/15 frasi o news che devono scorrere ciclicamente fino all'ultima e poi ripartire dalla prima...
Prova a dare un'occhiata a questo AS: legge delle news da un file xml in sequenza, e fin qui tutto bene. I problemi sono 2:
1 far scorrere le news senza pulsante ogni tot tempo
2 creare un ciclo quando arriva all'ultimo nodo, facendo ripartire il tutto dal primo e non come adesso che viene bloccato tutto dal comando "breack".......
images_xml = new XML();
images_xml.onLoad = startImageViewer;
images_xml.load("text.xml");
images_xml.ignoreWhite = true;
//
// Show the first image and intialize variables
function startImageViewer(success) {
if (success == true) {
rootNode = images_xml.firstChild;
// 'totalImages' is the variable name set to correspond with the the dynamic text instance of 'totalImages'
totalImages = rootNode.childNodes.length;
// [ totalImages = rootNode.childNodes.length; ] gets the total number of childNodes (total number of image and text files) in your .xml document
firstImageNode = rootNode.firstChild;
currentImageNode = firstImageNode;
// 'currentIndex' is the variable name set to correspond with the dynamic text instance of 'currentIndex'
currentIndex = 1;
// [ currentIndex = 1; ] sets the viewer to play the first childNode (first image and text file) in your .xml document
updateImage(firstImageNode);
}
}
//
// Updates the current image with new image and text
function updateImage(newImageNode) {
// 'imagePath' is the variable name set to correspond with the .jpeg file name located in your .xml document
imagePath = newImageNode.attributes.jpegURL;
// 'imageText' is the variable name for the instance 'textArea'
imageText = newImageNode.firstChild.nodeValue;
// 'targetClip' is the instance name for the movie clip 'imageArea', this is where all your image files from your .xml document are loaded
targetClip.loadMovie(imagePath);
}
next_btn.onRelease = function() {
nextImageNode = currentImageNode.nextSibling;
if (nextImageNode == null) {
break;
} else {
currentIndex++;
updateImage(nextImageNode);
currentImageNode = nextImageNode;
}
};
Mi spiace ma con xml non ti posso aiutare.