Scene 1
labels
frame 1
frame 4, (failed)
frame 9, (login)
frame 14, (chat)
frame 19
Actions
frame 1
actions for frame 1
stop();
function setChatText(msg) {
chatText += msg;
chatBox.htmlText = chatText;
scrollBar.setScrollPosition(chatBox.maxscroll);
}
function initializeChat (itWorked) {
if (itWorked) {
_root.gotoAndStop("login");
} else {
_root.gotoAndStop("failed");
}
}
function received (info) {
var from = info.firstChild.firstChild.attributes.from;
var message = info.firstChild.firstChild.firstChild.nodeValue;
setChatText("<br>" + from + ": " + message);
}
function connectionClosed() {
setChatText("The connection has been terminated.");
}
function closeConnection() {
server.close();
}
function send(messageToSend) {
server.send("<doc><message from=\"" +
screenName + "\">" + messageToSend +
"</message></doc>");
}
XML.prototype.ignorewhite = true;
server = new XMLSocket();
server.onConnect = initializeChat;
server.onXML = received;
server.onClose = connectionClosed;
server.connect("burrowww.cs.indiana.edu", 19671);
frame 4
frame 9
actions for frame 9
selection.setFocus("nameField");
frame 14
frame 19
Assets
frame 1
frame 4
Button_TryAgain
actions for Button_TryAgain
on (release) {
_root.gotoAndStop(1);
}
frame 9
(empty), <nameField>
Button_submit
actions for Button_submit
on (release, keyPress "<Enter>") {
if (nameField.text != "") {
screenName = nameField.text;
_root.gotoAndStop("chat");
}
}
frame 14
actions for frame 14
setChatText(screenName + ", you have just joined the chat.");
selection.setFocus("chatMessage");
(empty), <chatBox>
(empty), <chatMessage>
ScrollBar, <scrollBar>
Button_send
actions for Button_send
on (release, keyPress "<Enter>") {
if (chatMessage.text != "") {
send(chatMessage.text);
chatMessage.text = "";
}
}
Button_close
actions for Button_close
on (release) {
closeConnection();
}
frame 19
Background
frame 1
Background
logo