innanzitutto ciao a tutti (era tanto ke nn scrivevo qui)..![]()
ho un data base del genere:
------------------------------------
| username | usercolor | msg | time |
------------------------------------
un file php ke rikiama chat.swf?username=xxx&usercolor=yyy&join_time=zzz
qst swf dovrebbe essere pressapoco così:
--------------------------------------------------
| <font color=usercolor>username</font>: msg |
| <font color=usercolor>username</font>: msg |
| <font color=usercolor>username</font>: msg |
--------------------------------------------------
| |invia|
--------------------------------------------------
ora qst flash deve leggere da database attraverso un file rd_chat passandogli in GET join_time(data ingresso in chat)..A sua volta il file php seleziona i messaggi con time(data inserimento messaggio) > join_time [il fo.rmato è: totMsg=2&username1=xxx&usercolor1=yyy&msg1=zzz ecc ecc]..
Chat.swf deve stampare semplicemente a video qst messaggi e deve leggere continuamente da rd_chat mettendo in output solo i nuovi messaggi(rd_chat potrebbe anke modificare join_time restituendo un valore aggiornato)..
Poi deve scrivere (premendo invia) nel database attraverso wt_chat ke ricevendo tt i parametri scrive nel mysql..
inoltre vorrei mettere un cotrollo all'output: uno scrollbar ke segua man mano i vari messaggi..
Qk1 può aiutarmi direttamente col codice flash o indicarmi dove andare a sbattere la testa???
i file rd_chat e wt_chat sn gia compilati
GRAZIE a tt...
EDIT: se a qk1 può servire ho ftt un codice ke cmq è da perfezionare:
ciao a ttCodice:stop(); System.useCodepage = true; function rd_chat_file(){ rdchatfile = "chat/rd_chat.php?join_time="+join_time; rdchatObj = new LoadVars(); rdchatObj.load(rdchatfile); rdchatObj.onLoad = function(success){ if(success){ for (i = 1; i <= rdchatObj["totMsg"]; i++){ rdchatOut.htmlText += "<font color='#"+rdchatObj["usercolor"+i]+"'><b>"+rdchatObj["username"+i]+"</b></font>: "+rdchatObj["msg"+i]; rdchatOut.scroll = rdchatOut.maxscroll; } join_time = rdchatObj["join_time"]; } else { rdchatOut.htmlText = "<p align='center'><font color='#FF0000'><b>ERRORE: impossibile accedere al database</b></font></p>"; } } } function wt_chat_file(){ wtchatfile = "chat/wt_chat.php?username="+username+"&usercolor="+usercolor+"&msg="+wtchatImp.text; wtchatObj = new LoadVars(); wtchatObj.load(wtchatfile); wtchatObj.onLoad = function(success){ if(success){ wtchatImp.text = ''; } else { wtchatImp.text = "ERRORE: impossibile accedere al database"; } } } k = new Object(); k.onKeyDown = function(){ if (Key.getCode() == Key.ENTER && wtchatImp.text != undefined && wtchatImp.text != ""){ wt_chat_file(); } } Key.addListener(k) setInterval(rd_chat_file, 2500); e un bottone: on (release) { _root.wt_read_file() }

LinkBack URL
About LinkBacks
