|
-
the cheesy child
PHP mix up problem
Ok seriously, I feel that this is purposely trying not to work.
i got a chatroom.
username is the variable for user's username.
chat is the variable of where you type the message.
sender is a button.
board is the variable of where all the messages go.
I send messages typed in chat to PHP, write it to a txt file and then flash loads the txt file and copies it onto board as long as its not the same as last message...
here's my code... somebody modify it so that it will not let messages continuously send and also will send messages:
board = "";
//meshi is the start message for when you login
meshi = "Welcome,"+username+"! This is CheesySpace, where you can chat all you like in the cheesiest way ever!";
sound = new Sound();
sound.attachSound("message");
oldchat = "";
mesload = new LoadVars();
sendmes = new LoadVars();
sendmes.chat = meshi;
sendmes.send("write.php", "_blank", "GET");
sender.onPress = function(){
sendmessageya();
}
function sendmessageya(){
if(chat!==""&&chat!==" "){
sendmes.chat = username+" says:"+chat;
sendmes.send("write.php", "_blank", "GET");
}
chatmes.text = "";
}
onEnterFrame = function(){
mesload.load("message.txt");
mesload.onLoad = function(success){
if(success){
if(mesload.chat!==oldchat){
sound.start();
board = board+"\r"+mesload.chat;
oldchat = mesload.chat;
scrollmes.scroll = scrollmes.maxscroll;
}
}
}
}
stop();
oldchat = "";
chat = "Hello!";
ALSO!!! If you can help me, somebody help me make it so I can say when somebody signs out...
thank you all
julian
-
Hi,
two comments - a) loading a text file might not work well due to caching (when run from a browser, part of your users will never see an update to the text)
b) loading something from the server in an enterframe handler will not make you friends with the ISP, unless your frame rate is very, very low. May I suggest to use an interval timer instead
Musicman
-
the cheesy child
Hey I started this again and im gonna make it so it stores the last 5 messages and uses them but first i need to find out the topic on how to make php save multiple variables to a txt
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|