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.

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

  1. My coder is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the expenses. But he’s tryiong none the less. I’ve been using Movable-type on numerous websites for about a year and am worried about switching to another platform. I have heard excellent things about blogengine.net. Is there a way I can transfer all my wordpress content into it? Any kind of help would be really appreciated!

    Rispondi
  2. I think this is one of the so much important information for me. And i’m satisfied reading your article. However wanna statement on few basic things, The website taste is ideal, the articles is actually nice : D. Good process, cheers

    Rispondi
  3. I think what you postedtypedsaidbelieve what you postedwrotebelieve what you postedwrotebelieve what you postedtypedWhat you postedtypedsaid was very logicala lot of sense. But, what about this?think about this, what if you were to write a killer headlinetitle?content?wrote 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 titlesomethingheadlinetitle that grabbed people’s attention?maybe get a person’s attention?want more? I mean %BLOG_TITLE% is a little vanilla. You ought to peek at Yahoo’s home page and see how they createwrite post headlines to get viewers to click. You might add a related video or a related picture or two to get readers interested about what you’ve written. Just my opinion, it might bring your postsblog a little livelier.

    Rispondi
  4. Nice post. I was checking continuously this blog and I am impressed! Very useful information particularly the last part 🙂 I care for such info a lot. I was seeking this particular info for a long time. Thank you and good luck.

    Rispondi
  5. Hello there, simply become aware of your blog thru Google, and found that it is really informative. I’m gonna watch out for brussels. I will appreciate if you continue this in future. A lot of folks can be benefited from your writing. Cheers!

    Rispondi
  6. I like the valuable information you supply for your articles. I will bookmark your weblog and test again here frequently. I am somewhat certain I will be informed plenty of new stuff right here! Good luck for the following!

    Rispondi
  7. Does your website have a contact page? I’m having a tough time locating it but, I’d like to send you an e-mail. I’ve got some creative ideas for your blog you might be interested in hearing. Either way, great website and I look forward to seeing it develop over time.

    Rispondi
  8. Hello there, simply become aware of your blog thru Google, and found that it is really informative. I’m gonna watch out for brussels. I will appreciate in case you continue this in future. A lot of folks might be benefited from your writing. Cheers!

    Rispondi
  9. I don’t know if it’s just me or if everyone else experiencing problems with your website. It appears like some of the text on your posts are running off the screen. Can someone else please comment and let me know if this is happening to them too? This could be a problem with my browser because I’ve had this happen before. Appreciate it

    Rispondi
  10. Howdy just wanted to give you a quick heads up. The text in your post seem to be running off the screen in Internet explorer. I’m not sure if this is a format issue or something to do with internet browser compatibility but I thought I’d post to let you know. The design and style look great though! Hope you get the problem solved soon. Cheers

    Rispondi
  11. I feel this is one of the such a lot significant information for me. And i’m satisfied reading your article. However want to statement on few basic things, The site taste is great, the articles is actually nice : D. Good process, cheers

    Rispondi
  12. You really make it seem so easy with your presentation but I find this topic to be really something which I think I would never understand. It seems too complicated and very broad for me. I am looking forward for your next post, I will try to get the hang of it!

    Rispondi
  13. Fantastic beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog web site? The account aided me a acceptable deal. I had been tiny bit acquainted of this your broadcast provided bright clear concept

    Rispondi
  14. Howdy! Someone in my Myspace group shared this site with us so I came to look it over. I’m definitely enjoying the information. I’m book-marking and will be tweeting this to my followers! Fantastic blog and fantastic design and style.

    Rispondi
  15. We stumbled over here from a different page and thought I might as well check things out. I like what I see so now i am following you. Look forward to looking over your web page yet again.

    Rispondi
  16. Hey! This post couldn’t be written any better! Reading this post reminds me of my old room mate! He always kept talking about this. I will forward this post to him. Pretty sure he will have a good read. Thanks for sharing!

    Rispondi
  17. What’s Happening i’m new to this, I stumbled upon this I have found It positively helpful and it has helped me out loads. I am hoping to give a contribution & aid other users like its helped me. Good job.

    Rispondi
  18. Thanks for your marvelous posting! I genuinely enjoyed reading it, you are a great author. I will be sure to bookmark your blog and will eventually come back from now on. I want to encourage you to ultimately continue your great posts, have a nice afternoon!

    Rispondi
  19. My coder is trying to persuade me to move to .net from PHP. I have always disliked the idea because of the expenses. But he’s tryiong none the less. I’ve been using Movable-type on numerous websites for about a year and am worried about switching to another platform. I have heard great things about blogengine.net. Is there a way I can transfer all my wordpress content into it? Any kind of help would be really appreciated!

    Rispondi

Lascia un commento