00:00
00:00
Greth-of-destruction
hello little one

Raven J. @Greth-of-destruction

Age 30, Male

Nazi Mod Assassin

Salt Lake City, UT

Joined on 6/14/07

Level:
34
Exp Points:
12,474 / 12,830
Exp Rank:
2,272
Vote Power:
7.54 votes
Rank:
Safety Patrol
Global Rank:
30,096
Blams:
148
Saves:
174
B/P Bonus:
6%
Whistle:
Gold
Medals:
356

Ahhh the chatbox code.

Posted by Greth-of-destruction - January 18th, 2009


I have this post here to explain a chatbox code that I have created.

Make sure that you private message me if you have any questions. I will reply. ;)

Here is the code (goes on the frame):

textboxrecord = "Welcome to the Chatbox!" + newline;
texttype = "";

sendbtn.onRelease = function(){
if(texttype == undefined){
textboxrecord = textboxrecord + newline + "ChatBox: Please enter a valid message."
autokick.nextFrame()
}
if(texttype == ""){
textboxrecord = textboxrecord + newline + "ChatBox: Please enter a valid message."
autokick.nextFrame()
}
if(texttype !== ""){
textboxrecord = textboxrecord + newline + username1 + ": " + texttype
texttype = ""
autokick.gotoAndStop(1)
}
};

Now, that's a long code, so I am going to take out the unnecessary bits of it.

Here's the edited one:

textboxrecord = "Welcome to the Chatbox!" + newline;
texttype = "";

sendbtn.onRelease = function(){
if(texttype == undefined){
textboxrecord = textboxrecord + newline + "ChatBox: Please enter a valid message."
}
if(texttype == ""){
textboxrecord = textboxrecord + newline + "ChatBox: Please enter a valid message."
}
if(texttype !== ""){
textboxrecord = textboxrecord + newline + username1 + ": " + texttype
texttype = ""
}
};

Basically what I took out was the auto-kick, which can be added later on if wanted. I will try to provide a flash file without any password protected areas and secret information that my colleagues and I would not like released to the public. Anyway, here comes the long explanation, so pay attention. :)

Items that you need:
1 dynamic textbox with a variable of "textboxrecord" without the quotes.
1 input textbox with a variable of "texttype" without the quotes.
1 button with an instance name of "sendbtn".
For login/user-defined posts: 1 input text with a variable of "username1"
Keep in mind that while I provide some variables and instance names, you DO NOT need these, as you can always edit the code.

On to the explanation:

(you can use any of the codes above, or you can use this one with the explanations, if you like)

textboxrecord = "Welcome to the Chatbox!" + newline;
texttype = "";

sendbtn.onRelease = function(){
//the function that occurs on release of the button "sendbtn"
if(texttype == undefined){
//if texttype has nothing written in it and is not selected
textboxrecord = textboxrecord + newline + "ChatBox: Please enter a valid message."
//gives a message: "please enter a valid message."
}
if(texttype == ""){
//if texttype is selected but has nothing written in it
textboxrecord = textboxrecord + newline + "ChatBox: Please enter a valid message."
//gives a message: "please enter a valid message."
}
if(texttype !== ""){
//if texttype has something written in it
textboxrecord = textboxrecord + newline + username1 + ": " + texttype
//this is the actual line of chat
texttype = ""
//this clears the typing field, making it easier to type new messages, and harder for spammers
}
};

I hope you guys enjoy. There's a screenshot of what you ought to have below. ;)

NOTES:

1. Remember that ALL CODES go on the frame!

2. If you want to add "autokick" to your chatbox, all you need to do is copy the first code, make a movieclip with an instance name of "autokick", and make three frames (inside the movieclip). On the third frame, add this code: "_root.gotoAndStop(2);" (without the quotes, of course!). Now, leave the movieclip and add a second frame to the Flash file. On this frame, all you need do is make an input and dynamic textbox (nothing written inside either one!), and on the frame, add this code: (SHIT! I can't find the code... I'll post it later. Just follow these steps, and if you're interested in the auto-kick feature, either come back in a few hours/days and I should have it. PM me if you like.)

-GOD

Ahhh the chatbox code.


Comments

That's. . . Interesting.

A little too much, eh? LOL.

I'm gonna try that right now!

Glad to hear it. Spread the word. ^^

Also, if you have any issues with it, tell me and I'll gladly help you.

-GOD