# chat with a refresh system without FMS server # to compile with swfc (http://www.swftools.org) .flash name="flac.swf" bbox=700x550 version=6 background=#444444 .edittext chat width=640 height=470 color=black html multiline border .edittext saisie width=640 height=20 color=black border .edittext liste width=100 height=470 color=black border html multiline .edittext envoi width=100 height=20 color=black border .put chat 0 0 .put saisie 0 473 .put envoi 642 473 .put liste 642 0 .action: var v1= _root; var mystyl=new styleSheet; mystyl.setStyle("a",{fontFamily:'Arial',fontSize:'11px',textDecoration:'underline',color:'#FF0000'}); String.prototype.filtre = function () { var v2=this; v2=v2.split('&') ;v2=v2.join('et'); return v2; }; Selection.setFocus('liste'); var sendChat = new LoadVars(); var loadChat = new LoadVars(); var inpinp = new LoadVars(); var outinp = new LoadVars(); var msg , num , ltm ; var isMessage=false ; var envoiMessage = function () { msg = v1.saisie.text; isMessage = true; saisie.text = ''; inpinp.t = msg; inpinp.sendAndLoad('inpu.php',outinp); }; v1.envoi.onPress = function () { if (isMessage == false) envoiMessage(); }; var maTouche= new Object(); maTouche.onKeyDown = function () { if (isMessage == false) { if (Key.isDown(13)) envoiMessage(); } }; Key.addListener(maTouche); var perio = function () { clearInterval(ltm); if (isMessage == true) { sendChat.msg = msg; Selection.setFocus('saisie'); isMessage = false; } else sendChat.msg = ''; var monIdMessage = num; sendChat.monIdMessage = num; sendChat.sendAndLoad('perio.php',loadChat); }; // perio.php renvoit 3 variables: users,msg,nombre loadChat.onLoad = function () { var uListe = loadChat.users; v1.liste.htmlText = uListe; ltm = setInterval( perio, 2000); var t_txt=loadChat.msg; if (t_txt.length >= 10000) t_txt = t_txt.slice(0,5000); v1.chat.htmlText = t_txt; // la variable du php va dans le champs textfield v1.chat.scroll = v1.chat.maxscroll; num = loadChat.nombre; v1.envoi.text='n='+num; }; msg = ''; v1.saisie.backgroundcolor=0x990000; ltm = setInterval(perio, 2000); Selection.setFocus('saisie'); .end .end