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

Spread the love

Oggi vedremo come realizzare una simpatica chat da inserire in un box del nostro sito web. Uno strumento leggero e utile per chi vuole cominciare ad entrare nel mondo della comunicazione virtuale.

Essendo alle prime armi utilizzeremo come supporto software un programma abbastanza comune e di semplice utilizzo: Adobe Macromedia Flash (il tutorial si basa sulla versione CS4). Questo per realizzare un’applicazione chat di piccole dimensioni e soprattutto semplicistica. Ovviamente riporto a guide più approfondite per la creazione di chat professionali.

Cominciamo preparando la base e quindi avviando il software dal menu Start, Tutti i programmi, Adobe, Macromedia Flash CS4.

Nel nostro scenario creato a piacere dall’utente con colori di sfondo, immagini roteanti o semplicemente testuale avremo bisogno di inserire:

– Testo dinamico con cui appariranno tutti i messaggi degli utenti
– Testi di immissione dati dove si potrà scrivere nome utente e messaggio
– Pulsante di invio per inviare il messaggio

Per chi volesse fare qualcosa di più creativo nelle ultime lezioni, come sempre dedicate ai più esperti vedremo come inserire:

– Pulsanti di cambio colore del testo
– Pulsanti di timeshift per la chat

Per un tipo di applicazione del genere, utilizzeremo come file di input/output un documento di testo che conterrà all’incirca una quindicina di messaggi e non di più, giusto per non appesantire l’applicazione.
Per fare questo abbiamo bisogno di introdurre gli script ASP (permettono di rendere dinamiche le pagine HTML) che serviranno distintamente ad effettuare l’acquisizione del messaggio e l’invio alla chat.

Ma cominciamo con realizzare la nostra interfaccia grafica:

Per prima cosa occorre creare e posizionare sullo scenario un “Campo di testo dinamico” che sarà il nostro contenitore di messaggi. A questo punto occorrerà creare due campi di testo per inserire rispettivamente il testo di Input (che chiameremo “messaggio”) ed un altro che chiameremo “utente” (dove ovviamente sarà inserito il nome utente.

Ora ci manca ancora qualcosa: il pulsante per inviare il messaggio.

Selezioniamo sempre dalla barra posta a destra l’opzione “Pulsante” ed associamo allo stesso delle righe di codice nel linguaggio ActionScript (nativo di Flash):

on (release, keyPress “<Enter>”) {
         stringa = “<font color='”+color+”‘>”+user+” _ “+msg+”</font>”;
         loadVariablesNum (“resp.asp”, 0, “POST”);
         msg = undefined;
         refresher.gotoAndPlay(1);
}

Con questo codice, noi diamo informazioni precise:
il pulsante viene attivato quando ci si preme sopra o quando si batte “Invio” sulla tastiera, Il pulsante immette il messaggio ed il nickname separando con il trattino basso l’user ed il messaggio. Alla fine, dopo l’immissione si ordina un refresh della chat.
Abbiamo visto fino ad ora come creare una mini chat non complessa in Flash, nelle prossime lezioni vedremo come ampliarla e perfezionarla ad hoc per le nostre esigenze.

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

  1. This is the right blog for anybody who really wants to find out about this topic. You understand so much its almost hard to argue with you (not that I actually would want toHaHa). You definitely put a brand new spin on a topic that’s been written about for decades. Excellent stuff, just excellent!

    Rispondi
  2. This design is spectacular! You certainly know how to keep a reader entertained. Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job. I really enjoyed what you had to say, and more than that, how you presented it. Too cool!

    Rispondi
  3. Simply wish to say your article is as astonishing. The clearness in your post is simply excellent and i can assume you are an expert on this subject. Well with your permission allow me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please keep up the gratifying work.

    Rispondi
  4. Howdy, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam feedback? If so how do you prevent it, any plugin or anything you can advise? I get so much lately it’s driving me insane so any help is very much appreciated.

    Rispondi
  5. Hi would you mind letting me know which hosting company you’re utilizing? I’ve loaded your blog in 3 completely different internet browsers and I must say this blog loads a lot quicker then most. Can you suggest a good internet hosting provider at a honest price? Cheers, I appreciate it!

    Rispondi
  6. I was wondering if you ever considered changing the page layout of your site? Its very well written; I love what youve got to say. But maybe you could a little more in the way of content so people could connect with it better. Youve got an awful lot of text for only having one or two images. Maybe you could space it out better?

    Rispondi
  7. Hi! I’ve been following your web site for a while now and finally got the bravery to go ahead and give you a shout out from Kingwood Tx! Just wanted to mention keep up the excellent job!

    Rispondi
  8. andrejpos.com
    반대로 강당 한구석에 서 있던 예식실 비서가 황급히 교과서를 가져왔다.그에게 동정심을 갖고 “나는 당신의 이름을 모른다”고 나선 사람들도 적지 않았습니다.

    Rispondi
  9. Woah! I’m really enjoying the template/theme of this blog. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say that you’ve done a great job with this. Also, the blog loads super fast for me on Chrome. Exceptional Blog!

    Rispondi
  10. I was very pleased to find this web-site.I wanted to thanks for your time for this wonderful read!! I definitely enjoying every little bit of it and I have you bookmarked to check out new stuff you blog post.

    Rispondi
  11. I have 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 opinion, if all site owners and bloggers made good content as you did, the internet will be much more useful than ever before.

    Rispondi

Lascia un commento