una cosa del genere
codice:
io.html=true;
io.htmlText="<u>Powered by SK</u>";
totale=1
testo = new LoadVars();
testo.path = this;
this.path.mio.html=true;
this.path.mio.htmlText="Loading Data From DataBase";
testo.onLoad = function(success) {
if (success) {
this.path.mio.html=true;
this.path.mio.htmlText = testo["news"+totale];
cambia();
} else {
trace("Errore nel caricamento file!");
this.path.mio.html=true;
this.path.mio.htmlText="...... No Connection or Loose File ! ......
...... Please contact the Administrator ......";
}
};
testo.load("news.txt");
function cambia(){
function callback() {
clearInterval( intervalID );
if(totale!=testo.tot){
totale++
_root.mio.htmlText = testo["news"+totale];
cambia();
}else{
totale=0
_parent.mio.htmlText = testo["news"+totale];
cambia();
}
}
var intervalID;
intervalID = setInterval( callback, 4000 );//aumenta per aumentare l'attesa da news a news
};
creati un campo di testo dinamiko e dagli nome istanza "mio"
creati il file di testo e kiamalo "new.txt"
dentro scrivi le news kosì:
&tot=3&news1=Prova news uno&news2=Prova news due&news3=Prova news tre
dove &tot deve essere uguale al totale delle news
per farlo da db non cambia quasi nulla, ti devi solo creare il db fargli fare la query e restituire a video la stessa kosa
PS: il codice non è proprio perfetto