The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.
[URL]http://www.pocketmonkey.co.uk/chat/[/URL]
Very, very simple 'live' Flash chat room I knocked up as an experiment last night whilst drunk or something. It basically loops at an interval, picks up the 'last message' file and compares that one stored in a Flash variable to see if there's been a change, then it updates depending. I know of one potential flaw with this design, and that's if two people post at exactly the same time. It only updates every half second, so you can see how that would occur. (it can be improved by giving each new message a unique id, then looping and returning each one, but for efficiency - even though I have unlimited webspace - I'll leave this method for another time perhaps)
I'm interested to see if it affects your system resources, performance, etc. It doesn't on mine, but slower machines may suffer - although I don't think they will, like I said it's very, very simple. You'll notice on the connection status thing in the system tray that it's always receiving packets. This is because of what I said above with the looping. It's only receiving one small data file every half second (the last message), it doesn't store message history so there's no need for it to load more than that one file, for the sake of efficiency.
So there you go, enjoy.
(I'll post the code here if anyone's interested, but there's hardly anything involved - the Flash/PHP integration is pretty interesting and useful though, if anyone wants to know how to do that)
EDIT: clearly there's an issue with the font being too small. It's a nice pixel-font here, but Flash hasn't loaded it for some reason. Will sort out for next update, you'll have to zoom-in for now, sorry.
Oh, and the username box is a multiline one by accident - press 'connect', not return to continue.
Good for something you 'knocked up when drunk' (like that lad ... Marvin) although really it took you painstaking hours :p
> (to zoom in, right click the white bit and click zoom in)
Yeah 'the white bit' is the rest of the page background surrounding the chat bit.
First scene - "Username", button pressed which writes username input to variable:
on(release)
{
if(_root.username.text != "")
{ gotoAndPlay("main"); _global.username = _root.username.text; }
}
Next scene: "main"...
In first frame of timeline in Flash:
stop();
_root.local.username.text = _global.username;
_global.maincontent = "Never give out your details on the internet.";
setInterval(loadstuff, 600);
function loadstuff() {
id = Math.random() * 1000;
loadVariables("file_convo.data?uniq=" + id, _root);
if(_root.newcontent != _global.content && _root.newcontent != "" && _global.content != "") {
_global.maincontent = (_root.newcontent + "\n--------------------------\n") + _global.maincontent;
_global.content = _root.newcontent; }
}
Elsewhere on a clip...
onClipEvent(enterFrame)
{ _root.maincontent.text = _global.maincontent; }
In the 'Post This' button - this sends a form (forms in Flash are MC names with input boxes as the field and POSTed variable name)
on(release)
{
if(_root.local.content.text != "")
{ _root.local.loadVariables("update.php", "POST");
_root.local.content.text = "";
runid = 2; }
}
Then in the 'update.php' file which was called by the button - same as
Tip for new testers. Right click to get the Flash controls up and click Show All to get a better display size.