PDA

View Full Version : Flash chat client app


the_Flasher
01-29-2003, 10:28 AM
Dear all,

need help in building something of a chat client in Flash and PHP. i've got everything pretty much figured out, but what i hope to find out here is what method is best used for refreshing the chat area?

i'm really in over my head here, trying to figure how to do this. before i go on, allow me to brief you on how this thing works.
i have a backend PHP script that reads/grabs from a text file, all the chat-contents. this PHP script obtains the contents, and outputs it into a flash variable:

eg: &transcript=blah blah blah blah

then i use 'loadVariables' to display the contents into a dynamic text field in the movie.
to refresh the chat area, i use 'setInterval' to invoke loadVariables to the PHP script again, thus, refreshing the '&transcript' variable.

however, i don't think this is the best method, because after loadVariables in invoked a number of times, my Flash player increases CPU usage, and hangs after awhile. i'm thinking that each time 'setInterval' is used, it's filling up a memory buffer somewhere.. until it gets full, and explodes. :-(

so i'm seeking help from any experienced fellows out there who has done a chat thinggie.. and advise me on how i can refresh the chat area of my chat client.

any help is appreciated!!

let me know if anything is not clear!! Thanks a ga-zillion!

freddycodes
01-29-2003, 04:38 PM
In my opinion its not really a chat app unless the chat is in realtime. Using loadVariables to read from a text file, is not really real-time, and like you said can be a bull on the CPU. You are gonna want to look at XML Sockets. PHP can be used to make a Socket Server, but I prefer to use Perl. it makes it so much easier.

I have made a chat using Flash MX and Perl. Its realtime, because everyone connected is connected to the Perl Socket Server via sockets. The traffic comes accross the sockets instead of via HTTP.

Have a look.
http://www.irq11.com/~louie/chat6.html

Source
http://www.irq11.com/~louie/chat_dist.zip

fozzyuw
02-19-2003, 10:24 PM
I've tried our your demo and I like it alot. I'm hoping to play around with it.

My question is, is it possible to get the code in flash5 because I don't have MX. And where do I put the perl script on my server?

I've tossed it in the same directory and the cgi-bin directory but neither seem to be working because the demo isn't connecting when I try to test it on my own website.

www.polarcats.net/tempchat2

Thanks,
Fozzy

freddycodes
02-19-2003, 10:31 PM
The perl script runs as a process on the server and does not get access through a browser. You would need to change the perl script to match your server configuration. And you also need to change things in the fla, so if you don't have MX chances are you won't be able to use it. Also if you cannot run processes on the server, ie you are on some shared host that doesn't allow it, it won't work either.

I have a another one done with PHP and Flash MX, I would be willing to sell it and help you get it installed somewhere if you are interested, PM me.
http://www.irq11.com/~louie/freddyChat/freddyChat.html

fozzyuw
02-19-2003, 10:37 PM
I do have access to MX but at work/univeristy. So I'll try to play with it there. I'll try changing the files around and see if I can get it to work.

Otherwise, I'll chat with you on PM =)

Thanks!

Jukkis
04-23-2003, 11:33 AM
Originally posted by freddycodes
The perl script runs as a process on the server and does not get access through a browser. You would need to change the perl script to match your server configuration. And you also need to change things in the fla, so if you don't have MX chances are you won't be able to use it. Also if you cannot run processes on the server, ie you are on some shared host that doesn't allow it, it won't work either.

so basically for using the .pl script I need a simple web-server where I can run the script as a process ?

freddycodes
04-23-2003, 04:52 PM
Not a web server. It runs as a daemon on the server, server meaning physical macine. A webserver is another type of daemon running on a machine.

Jukkis
04-23-2003, 05:07 PM
ok.

well basically 'daemon' was the word I was looking for. :)

xquisite.me
01-02-2009, 11:39 AM
Hey guys
i want to make a cht for my site like http://www.123flashchat.com
can any one help plz pm me.
:)