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

Spread the love

L’ultima lezione per la realizzazione della nostra chat sviluppata in Flash per il nostro sito, ci permetterà di renderla più simpatica e gradevole dal punto di vista estetico, infatti doneremo un tocco di colore.

Secondo quanto abbiamo predisposto in precedenza (vedi lezione 1), oltre ai controlli di testo ed il pulsante invia, avremo altri controlli tra cui: pulsanti di selezione “refresh time” di 5 e 10 secondi. Il refresh da 5 secondi verrà inserito sul fotogramma numero 58-60 (è consigliabile il 60 per avere unaparità di valori durante l’utilizzo), mentre quello da 10 secondi sul fotogramma 118-120 (consigliabile 120 per le motivazioni di prima).
Il codice ActionScript che utilizzeremo per il refresh sarà il seguente:

Caso di refresh ogni 5 secondi:

if (reftime==1){
q = random(999999);
loadVariablesNum (“refresh.asp?q=”+q, 0, “POST”);
gotoAndPlay(1);
}

Caso di refresh ogni 10 secondi:

q = random(999999);
loadVariablesNum (“refresh.asp?q=”+q, 0, “POST”);

Inseriamo quindi in questo momento il codice ASP dello script refresh (lo esaminiamo con i soliti commenti per comprendere quello che stiamo facendo):

<%
Dim strLinea, FileObject, Instream, intVisite, intTipo, OutStream,allMsg
strFile = Server.MapPath(“msg.txt”)
‘Creiamo un oggetto
Set FileObject = Server.CreateObject(“Scripting.FileSystemObject”)
‘e lo apriamo in lettura
intTipo = 1
Set InStream = FileObject.OpenTextFile(strFile,IntTipo,true)
‘Leggiamo i messaggi dal file di testo
Do While not InStream.AtEndOfStream
         StrLinea = InStream.ReadLine()
         allMsg=allMsg&StrLinea&”<br />”
Loop
InStream.Close
Set InStream = Nothing
‘Inviamo tutti i messaggi alla chat Flash
Response.Write(“corpo=”&allMsg)
%>

Per una verifica finale, qualora decidessimo di aprire il file di testo, noteremmo una cosa del genere:

10.23.11 – <font color=’#FF0066′>Mario – ciao sono Mario</font>
10.22.58 – <font color=’#FF0066′>Luigi – ciao sono Luigi</font>

Ultimo passo è la creazione della pagina html che conterrà il nostro file chat.swf da creare con il seguente codice:

<html>
<head>
<title>La mia chat</title>
</head>
<body bgcolor=”#cccccc”>

<p>
<object type=”application/x-shockwave-flash” data=”chat.swf” width=”550″ height=”450″>
<param name=”movie” value=”chat.swf” />
<param name=”quality” value=”high” />
</object>
</p>

</body>
</html>

A lavoro terminato, salvare il file dando i permessi in lettura e scrittura completi su questo file.

Potremmo utilizzare così la nostra chat per rendere interattivo e dinamico il nostro sito web e cominciare ad avere nuovi rapporti con i nostri utenti molto spesso anonimi.

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

  1. Howdy would you mind stating which blog platform you’re working with? I’m looking to start my own blog in the near future but I’m having a difficult time choosing between BlogEngine/Wordpress/B2evolution and Drupal. The reason I ask is because your design seems different then most blogs and I’m looking for something completely unique. P.S Apologies for getting off-topic but I had to ask!

    Rispondi
  2. Hello there, simply was aware of your blog thru Google, and found that it is really informative. I’m gonna watch out for brussels. I will appreciate for those who continue this in future. Lots of other people will be benefited from your writing. Cheers!

    Rispondi
  3. I think what you postedwrotesaidbelieve what you postedwrotebelieve what you postedwrotesaidthink what you postedtypedsaidWhat you postedwrotesaid was very logicala lot of sense. But, what about this?consider this, what if you were to write a killer headlinetitle?content?typed a catchier title? I ain’t saying your content isn’t good.ain’t saying your content isn’t gooddon’t want to tell you how to run your blog, but what if you added a titleheadlinetitle that grabbed people’s attention?maybe get people’s attention?want more? I mean %BLOG_TITLE% is a little vanilla. You could look at Yahoo’s home page and watch how they createwrite news headlines to get viewers interested. You might add a video or a related picture or two to get readers interested about what you’ve written. Just my opinion, it could bring your postsblog a little livelier.

    Rispondi
  4. Oh my goodness! Awesome article dude! Thank you, However I am experiencing issues with your RSS. I don’t know why I can’t subscribe to it. Is there anybody else getting identical RSS problems? Anyone who knows the solution will you kindly respond? Thanx!!

    Rispondi
  5. Undeniably believe that that you stated. Your favourite justification appeared to be at the net the simplest thing to take into account of. I say to you, I definitely get irked even as other people consider worries that they plainly do not understand about. You controlled to hit the nail upon the top as well as defined out the whole thing with no need side effect , other folks can take a signal. Will likely be back to get more. Thank you

    Rispondi
  6. I’m really enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Great work!

    Rispondi
  7. Wonderful blog! Do you have any hints for aspiring writers? I’m planning to start my own site soon but I’m a little lost on everything. Would you propose starting with a free platform like WordPress or go for a paid option? There are so many choices out there that I’m totally confused .. Any recommendations? Thanks a lot!

    Rispondi
  8. Its like you read my mind! You seem to understand so much approximately this, like you wrote the ebook in it or something. I think that you could do with some p.c. to force the message house a bit, however other than that, this is fantastic blog. A great read. I’ll definitely be back.

    Rispondi
  9. Thank you, I have recently been searching for information approximately this topic for a while and yours is the best I have came upon so far. However, what about the conclusion? Are you positive about the source?

    Rispondi
  10. I was wondering if you ever considered changing the page layout of your blog? 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
  11. Ищете надежного подрядчика для устройства стяжки пола в Москве? Обратитесь к нам на сайт styazhka-pola24.ru! Мы предлагаем услуги по залитию стяжки пола любой сложности и площади, а также гарантируем высокое качество работ.

    Rispondi
  12. Hi, I do believe this is a great blog. I stumbledupon it 😉 I am going
    to come back once again since I bookmarked it. Money and freedom is the best way
    to change, may you be rich and continue to guide other people.

    Rispondi
  13. Greetings from Florida! I’m bored to death at work so I decided to browse your website on my iphone during lunch break.
    I really like the info you provide here and can’t wait to take a look when I get home.
    I’m amazed at how fast your blog loaded on my cell phone ..
    I’m not even using WIFI, just 3G .. Anyways,
    very good blog!

    Rispondi
  14. I was suggested this blog by my cousin. I am not sure whether this post is written by him as nobody else know such detailed
    about my difficulty. You’re amazing! Thanks!

    Rispondi
  15. Hello just wanted to give you a brief heads up and let you know a
    few of the pictures aren’t loading correctly. I’m
    not sure why but I think its a linking issue. I’ve tried it in two different browsers and both show the
    same outcome.

    Rispondi
  16. Hi, I do believe this is an excellent web site.
    I stumbledupon it 😉 I am going to revisit yet again since I bookmarked it.
    Money and freedom is the best way to change, may you be
    rich and continue to help other people.

    Rispondi
  17. Right here is the perfect site for anyone who hopes to understand this topic.
    You know a whole lot its almost hard to argue
    with you (not that I personally would want to…HaHa).
    You certainly put a brand new spin on a topic which has been discussed for many years.
    Wonderful stuff, just wonderful!

    Rispondi

Lascia un commento