Tutorial: Realizziamo una chat per il nostro sito (Lesson 2)

Spread the love

Cominciamo la nostra seconda lezione sulla creazione di una piccola chat da inserire in un box del nostro sito web, spiegando a cosa servono le righe di comando che abbiamo utilizzato nell’Action Script del pulsante Invia.

 

L’azione:

 

loadVariablesNum (“resp.asp”, 0, “POST”);

 

da l’avvio al inserimento del nuovo messaggio, effettua il refresh dei messaggi e pulisce il nostro campo di testo per inserire i nuovi messaggi.

Lo script di resp.asp, va comunque inserito in codice. Di seguito vedremo l’inserimento effettuato con i commenti per capire meglio passo passo cosa stiamo facendo:

<%
Dim strLinea, FileObject, Instream, intVisite, intTipo, OutStream, i, k, arrMsg(100), fine, allMsg
‘questa stringa permette l’utilizzo semplice in visualizzazione di : “username _ messaggio”
stringa = Trim(Request(“stringa”))
strFile = Server.MapPath(“msg.txt”)
definiamo l’oggetto creato in questo caso i messaggi che andranno in un file di testo
Set FileObject = Server.CreateObject(“Scripting.FileSystemObject”)
‘faccio la lettura del file
intTipo = 1 ‘ lettura
Set InStream = FileObject.OpenTextFile(strFile,IntTipo,true)
‘inseriamo il valore di data e ora al messaggio per fare in modo che in ordine cronologico siano aggiunti nella lista
i = 0
arrMsg(i) = FormatDateTime(Now(),3)&” – “&stringa
‘leggiamo il file di testo ed inseriamo i messaggi
Do While not InStream.AtEndOfStream
StrLinea = InStream.ReadLine()
i=i+1
arrMsg(i) = StrLinea
Loop
Set OutStream = FileObject.CreateTextFile(strFile, true)
‘determiniamo il numero massimo di messaggi
if i>15 then
fine=15
else
fine=i
end if
k=0
‘visualizziamo in Flash i messaggi inserendo il (br) a capo dove necessario
Do While k<=fine
OutStream.WriteLine(arrMsg(k))
allMsg=allMsg&arrMsg(k)&”<br />”
k=k+1
Loop
OutStream.Close
Set OutStream = Nothing
InStream.Close
Set InStream = Nothing
Set FileObject = Nothing
‘inviamo definitivamente i messaggi alla chat
Response.Write(“corpo=”&allMsg)
%>

Ecco, così abbiamo inserito il codice alla nostra chat e potremmo utilizzarla in modalità standard per dare la possibilità agli utenti del vostro sito di scambiare due chiacchiere. Ricordiamo che la versione utilizzata per la realizzazione di questo tutorial è l’ActionScript 4 incluso nella suite Adobe Macromedia Flash CS4 Professional.

Nella prossima ed ultima lezione, vedremo come dare un “tocco di colore” alla nostra chat.

7.664 commenti su “Tutorial: Realizziamo una chat per il nostro sito (Lesson 2)”

  1. Ozempic: Transforming Health Journeys

    Welcome to our wellness fans! If you’re exploring solutions for weight loss, you’ve surely come across this GLP-1 medication. This powerful drug has gained traction for its effectiveness to help users shed pounds. In this article, we’ll dive into what makes Ozempic so impactful and share a fantastic resource for practical tips.

    Semaglutide, a weight loss aid, works by mimicking a hormone that controls blood sugar. Patients often report better control throughout the day, which can lead to impressive health benefits. Research show remarkable outcomes for some users, positioning it as a go-to option for those struggling with obesity. But, with any drug, it comes with potential side effects, like digestive changes, so understanding the full picture is key.

    If you’re considering Ozempic, accessing detailed information is important. Here’s where a fantastic resource comes in: explore [url=https://ozempicblog.space]side effects guide[/url] for in-depth advice on success stories. The resource offers expert advice to guide your journey your health goals.

    Whether you’re experienced with semaglutide, mastering its impact can equip you to achieve your goals. With user experiences to managing side effects, the best information changes the game. Stay informed and best of luck on your health journey!|Share your stories with us! Stay healthy!

    Rispondi
  2. Автор статьи предлагает разные точки зрения на обсуждаемую проблему, позволяя читателям ознакомиться с различными аргументами и сделать собственные выводы.

    Rispondi

Lascia un commento