# Word box, but other than on tutorial

**URL:** <https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836>\
**Category:** flash\
**Created:** [November 8, 2002, 7:19pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836 "2002-11-08T19:19:08Z")\
**Posts on this page:** 19\
**Page:** 1

<div class="post-metadata">

**Author:** ![luster](https://avatars.discourse-cdn.com/v4/letter/l/ec9cab/32.png) [@luster](https://forum.kirupa.com/u/luster)\
**Post date:** [November 8, 2002, 7:19pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/1 "2002-11-08T19:19:08Z")

</div>

Hi,  
I am trying to make something, but it doesn’t seem to work.  
I want to make a word box that works like this: (i’ll now give a silly example, but just to show how it’s supposed to work)  
You type in: Cow and you press enter  
On the right you see: Animal that gives milk.

Can someone please help me? Use as less ActionScript as possible please, since i’m not very good at that.

Please help!!!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2002, 8:12pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/2 "2002-11-08T20:12:58Z")

</div>

I was just working on something similar to this. Not exactly it, but close enough I suppose.

Create an input text box and give it the instance name “comment”. Create another regular dynamic textbox and give that the instance name “result”.

Now this is where we get Components involved.

Open the components panel (F11 in Flash), and drag an instance of the scrollbar component and attach it to your dynamic text box with the instance name “result”. Now drag an instance of the Push Button component onto the stage. Click on the push button and open the properties panel (CTRL+F3), Next to “label”, write the text you want to be displayed on the button (I used “Submit”). Now next to Click Handler, type in “onSubmit” (no quotes).

Now right click on a frame and open the actions panel.

Copy and paste this into the window…

```auto
//ifCow is the function to check if the word is "Cow" or "cow"
//if it is, then it diplays "Animal the shoots milk at people"
//the 
 refers to starting a new line
//comment.text="" clears the comment input text area
//the else statement says that if it is not cow, then just
//display the current text in the comment input text area.
ifCow = function () {
	if (comment.text == "cow" or comment.text == "Cow") {
		result.text += "Animal that shoots milk at people 
";
		comment.text = "";
	} else {
		result.text += comment.text+"
";
		comment.text = "";
	}
};
//function I use on the submit button
//when the button is pressed it calls upon th ifCow function above.
onSubmit = function () {
	ifCow();
};
//standard stop action
stop();

```

I commented all the code so it would be easier for you to understand what each thing does.

I hope that points you in the right direction 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2002, 8:30pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/3 "2002-11-08T20:30:45Z")

</div>

well, since we were working on it at the same time anyway.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2002, 8:33pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/4 "2002-11-08T20:33:57Z")

</div>

LOL, yours is so much simpler.

I told you I always do things the hard way :-\

I cant post my file because it is too big, which is weird because all it is is 2 textboxes, scrollbar component, and push button :-\

Odd.

You forgot to terminate your multiline comment though.

You need to add a \*/ to the end there.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2002, 8:38pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/5 "2002-11-08T20:38:10Z")

</div>

Oh, man… I didnt forget, it’s just that if I added it, it would send my file size too high! hehhheehe… just kidding.

Here it is, fixed.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 8, 2002, 8:43pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/6 "2002-11-08T20:43:18Z")

</div>

LOL, I still don’t get why mine won’t upload.

There is nothing in the library except the scrollbar component parts.

And last I checked… textboxes don’t take up much space :-\

Stupid file…LOL.

Well at least luster learns 2 methods here.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 9, 2002, 3:01am UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/7 "2002-11-09T03:01:04Z")

</div>

I see you like having fun with functions. Soon you will be prototyping everything, just like POM hahahhhahaaha…

Just kidding, Pom! You

😛 😛 😛

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 9, 2002, 3:05am UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/8 "2002-11-09T03:05:21Z")

</div>

Actually, I already do Function and Prototype most of my code…lol.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 9, 2002, 9:21am UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/9 "2002-11-09T09:21:58Z")

</div>

Thanks for helping me out!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 9, 2002, 5:46pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/10 "2002-11-09T17:46:01Z")

</div>

No problem 🙂

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 10, 2002, 2:50pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/11 "2002-11-10T14:50:09Z")

</div>

Thanks for helping me out!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 10, 2002, 6:41pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/12 "2002-11-10T18:41:37Z")

</div>

Hey, don’t blame me about functions, Inigo, Supra talked me into it in the first place. 😛

And Lost, components take a huge amount of space if you don’t compress the code. I think there’s an option somewhere to do that.

pom :cowboy:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 10, 2002, 6:42pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/13 "2002-11-10T18:42:52Z")

</div>

Pom, you know Im just messing with you. As a matter of fact, we’ll have to have a sitdown one of these days to talk about proto’s and such.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 10, 2002, 6:46pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/14 "2002-11-10T18:46:05Z")

</div>

> \*Originally posted by Iammontoya \*  
> \*\*Oh, man… I didnt forget, it’s just that if I added it, it would send my file size too high! hehhheehe… just kidding.

Here it is, fixed. \*\*

btw, didnt i post the same code on the other thread? :sleep:

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 10, 2002, 6:56pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/15 "2002-11-10T18:56:53Z")

</div>

Any time, Inigo 🙂 [SIZE=1]well, not right now, I really need to get some work done.[/SIZE] Avec grand plaisir.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 10, 2002, 7:29pm UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/16 "2002-11-10T19:29:33Z")

</div>

Yeah Ilyas… yes I didn’t realize how much file size components take up, I just went to delete the Components folder in the library that Flash creates… and the scrollbar component uses 82 ITEMS!!!

:o

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 11, 2002, 3:43am UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/17 "2002-11-11T03:43:35Z")

</div>

Pom, we’ll do that… I think I have just the thing we need.

h88. I have no idea what you’re talking about. However, I know that had I seen similar code somewhere, I would not have wasted anytime replying to a post. I’ve seen similar comments from you on some other posts as well. Hmm… oh well. Your help on this site is appreciated. As you can see, we all pull in and we do our part to make sure this site remains the most useful one out there.

Cheers!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 11, 2002, 5:15am UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/18 "2002-11-11T05:15:42Z")

</div>

There are only so many ways you could do that anyway, there is bound to be a code that looks similar.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [November 11, 2002, 11:50am UTC](https://forum.kirupa.com/t/word-box-but-other-than-on-tutorial/7836/19 "2002-11-11T11:50:07Z")

</div>

> \*Originally posted by Iammontoya \*  
> **h88. I have no idea what you’re talking about. However, I know that had I seen similar code somewhere, I would not have wasted anytime replying to a post. I’ve seen similar comments from you on some other posts as well. Hmm.**

sorry Inigo, but i meant i posted something similar to ur previous attachment, here, [http://www.kirupaforum.com/showthread.php?s=&threadid=8844](http://www.kirupaforum.com/showthread.php?s=&threadid=8844)

> \*Originally posted by Iammontoya \*  
> **… oh well. Your help on this site is appreciated. As you can see, we all pull in and we do our part to make sure this site remains the most useful one out there**

oh well, am really glad to be a part of you guys, thanx for your appreciation Inigo! =)

yours,  
h88
