Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Actionscript > Flash MX (6) > Making a chatbot 1

Status
Not open for further replies.

MoleDirect

Technical User
Sep 4, 2007
45
US
Hi all.

I am working on a small chatbot that will have conditioned responses depending on words a user types in.. So far, it is a failure.. Here is the code i have:

Code:
on (release, keyPress "<Enter>") {
	if (_root.user.text=="Hi") {
		_root.reply.Text = "Hello";

		_root.user.text = "";
				
	}else{
		_root.reply.Text = "I have no idea";
}

This simple code should be looking for certain 'keywords' in a sentence, and responding to it using pre written answers.

When I run this now, it only replace the text in the inputbox with 'Hi' and thats it, the dynamic box does not change.

I am using Flash MX (6)..

Thanks in advance!!
 
It Works!!! Thank you!!

One more thing... on this stretch of code:

Code:
 if (_root.user.text=="Hi") {

Is there a way I cam make it look for the word in the sentence, instead of it having to be that exact value?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top