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.

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

  1. Good day! This is my first comment here so I just wanted to give a quick shout out and say I really enjoy reading through your articles. Can you recommend any other blogs/websites/forums that cover the same subjects? Thanks a lot!

    Rispondi
  2. I feel that is among the so much significant info for me. And i am satisfied studying your article. However should commentary on some basic issues, The site style is ideal, the articles is in reality excellent : D. Excellent activity, cheers

    Rispondi
  3. I’ve been surfing online more than 3 hours today, yet I never found any interesting article like yours. It’s pretty worth enough for me. In my view, if all web owners and bloggers made good content as you did, the net will be much more useful than ever before.

    Rispondi
  4. W Vavada jesteśmy dumni z bycia dynamicznie rozwijającą się platformą gier online, która zdobywa uznanie graczy z Polski. Naszym celem jest zapewnienie najwyższej jakości rozrywki w bezpiecznym i przyjaznym środowisku. Strona internetowa kasyna jest w pełni przetłumaczona na język polski, a nasza obsługa klienta dostępna jest w języku ojczystym, co czyni Vavada idealnym wyborem dla polskich entuzjastów gier losowych.

    Rispondi
  5. Dude.. I am not much into reading, but somehow I got to read lots of articles on your blog. Its amazing how interesting it is for me to visit you very often. –

    Rispondi
  6. I was skeptical about CBD at commencement, but after trying them like [url=https://joyorganics.com/pages/wholesale-cbd ]cbd oil wholesale[/url], I’m unqualifiedly impressed. They presentation a commodious and enjoyable sense to undergo CBD without any hassle. I’ve noticed a calming effect, primarily in the evenings, which has helped with both anguish and sleep. The best generally is the pre-measured dosage, so there’s no guessing involved. If you’re looking for an straightforward and tasty acknowledge proceeding to know CBD, gummies are definitely advantage in the light of—straight make unwavering to buy from a honourable disgrace!

    Rispondi
  7. However, it is virtually all done with tongues rooted solidly in cheeks, and everyone has absolutely nothing but absolutely love for his or her friendly neighborhood scapegoat. The truth is, he is not just a pushover. He is basically that special variety of person strong enough to take all of that good natured ribbing for exactly what it is.

    Rispondi
  8. However, it is virtually all done with tongues rooted solidly in cheeks, and everyone has absolutely nothing but absolutely love for his or her friendly neighborhood scapegoat. The truth is, he is not just a pushover. He is basically that special variety of person strong enough to take all of that good natured ribbing for exactly what it is.

    Rispondi
  9. I’ve been taking [url=https://www.cornbreadhemp.com/collections/full-spectrum-cbd-oil ]full spectrum cbd oil with thc[/url] with a view a while at once, and they’ve honestly been a game-changer against highlight and sleep. The first-rate part? No grogginess in the morning unbiased a cool off, composed perception before bed. With an increment of, they have knowledge of great, unequal to some other supplements I’ve tried. I was skeptical at first, but after daily using them, I can unquestionably translate they help with unwinding after a great day. If you’re looking for a unembellished practice to deject without any spooky side effects, CBD gummies are advantage trying. Principled provoke steadfast you get a grade brand with third-party testing!

    Rispondi
  10. Easily, the post is really the greatest on this laudable topic. I concur with your conclusions and will thirstily look forward to your future updates. Saying thank will not just be sufficient, for the wonderful c lucidity in your writing. I will instantly grab your rss feed to stay privy of any updates. Solid work and much success in your business enterprise!

    Rispondi
  11. I’ve been using https://www.cornbreadhemp.com/collections/full-spectrum-cbd-oil concerning a while conditions, and they’ve frankly been a game-changer against burden and sleep. The excellent part? No grogginess in the morning just a undisturbed, mellow feeling before bed. Gain, they have knowledge of outstanding, unlike some other supplements I’ve tried. I was skeptical at key, but after devotedly using them, I can decidedly say they help with unwinding after a extended day. If you’re looking on a ordinary practice to iciness without any weird side effects, CBD gummies are worth trying. Unbiased provoke unflinching you get a grade brand with third-party testing!

    Rispondi

Lascia un commento