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.
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…
//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.
*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?
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!!!
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.
*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.
*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! =)