Ok this is so much easier than it sounds. For some reason, I never know the easy stuff. I have 1 variabled called input. It’s an input textbox. I also have a button. How would I make it when the button is pressed, if the textbox contains the word(s) <li> or </li> in it, the variable shows, “Denied”?
mybutttton.onPress = function ()
{
if ( myinput.text.indexOf(’<li>’) == -1 ) myinput.text = “denied”;
}
I’m not sure if this is exactly what you want, but you might try something like this:
[AS]
var myVariable;
_root.myButton.onPress = function(){
if(input == “<li>” || input == “</li>”){
myVariable = “denied”;
}
else myVariable = “accepted”;
trace(myVariable);
}
[/AS]
I don’t know if it’s possible, but look up “restrict” in the actionscript dictionary. You can restrict which character ranges are valid inputs. It might be possible with cleverness and patience, but I think you might have to use PHP or similar language to do that kind of check.
–EP
Edit* nm, the all-mighty Ahmed who is wiser and Frinkier than I has solved the problem…
WHY GOD WHY!!! :pope:
lol
I don’t know if restrict works for strings, like <li>… i know it works for characters though
Indeed, using String.indexOf is better. So forget my first post
Lol, ‘restrict’ stops the characters. I want the people to be able to type in <, >, /, l and i. - BTW, it doesn’t work, Ahmed. I put the actions on the button, it says the it needs an on handler.
you don’t put it on the button, place it on the timeline where the button is
Still doesn’t work.
- The variable is input and has no instance. The button has no instance. The actions are on the timeline…
.
Ah, thanks. Wasn’t my fault I didn’t understand though. You shoulve told be that mybutton and myinput were instances.
thought it was too obvious :sigh: lol
Hey I’m slow when it comes to AS. I don’t know how to tell when something is an instance and stuff like that. How’d you get so good at AS?