-
why this action not working
button_btn.onRelease= function() {
if (text_txt=="" ) {
stop();
thanks
-
The Flashman
what is text_txt? is that a variable or a dynamic textbox?
where is your button placed? and what are you trying to stop?
i eat actionscripts for breakfast
-
Flashkit Veteran
also you forgot a '}' at the end
-
i have a dynamic text box and button , the user must enter a value in the text box to start.
//i put this action
button_btn.onRelease=function() {
if (text_txt="")
stop();
}
-
Who, What, Why ... ?
Use either:
code: button_btn.onRelease=function() {
if (_root.yourPath.text_txt.text=""){
stop();
}
}
or
code: button_btn.onRelease=function() {
if (_root.yourPath.text_txt=""){
stop();
}
}
I cant remeber whether you need to use the "TEXT" value or not. I used it in a similar function once, but other people dont use it.
You were also missing a curly brace after your if statement.
Regards,
-
thanks a lot ,
but what do u mean by yourpath. and it's stop all the time "" or full.
stop();
Next_btn.onRelease= function() {
if (text_txt == "" ) {
stop();
} else if (text_txt == "hussain") {
gotoAndplay("Q2");
} else if (text_txt == "Hussain") {
gotoAndplay("Q2");
} else if (text_txt =="HUSSAIN" ) {
gotoAndStop(Q2);
} else {
gotoAndPlay("Q2");
}
}
-
Who, What, Why ... ?
code: Next_btn.onRelease= function() {
if (_root.yourPath.text_txt = "" ) {
_root.yourpath.text_txt.txt ="Type something";
}else if(_root.yourPath.text_txt = "hussain" || "Hussain" || "HUSSAIN") {
_root.gotoAndPlay(Q2);
}
}
yourPath is the path that leads to your text field.
Are you giving you text field a variable name or an instance name?
Regards,
Last edited by Fraggs; 10-05-2004 at 08:27 AM.
-
Monkey Moderator
Originally posted by Fraggs
code: Next_btn.onRelease= function() {
if (_root.yourPath.text_txt = "" ) {
_root.yourpath.text_txt.txt ="Type something";
}else if(_root.yourPath.text_txt = "hussain" || "Hussain" || "HUSSAIN") {
_root.gotoAndPlay(Q2);
}
}
Frags, that is not a valid comparrison in actionscript, you need to use "==" (for comparrison) instead of "=" (which is for assignment).
Also you cannot add OR's in the way you have...
A correct comparrison would be...
code:
if(_root.yourPath.text_txt=="hussain" || _root.yourPath.text_txt=="Hussain" || _root.yourPath.text_txt=="HUSSAIN"){
Anyway, there is no need for all those comparisons as you can just convert the input text to lowercase for comparrison...
code:
// assuming your input box instance name is txtInstanceName
btn.onRelease = function(){
if (txtInstanceName.text.toLowerCase() == "hussain"){
gotoAndPlay(Q2);
} else {
stop();
}
}
// or //
// assuming your input box variable name is txtVariableName
btn.onRelease = function(){
if (txtVariableName.toLowerCase() == "hussain"){
gotoAndPlay(Q2);
} else {
stop();
}
}
www.lexicon-design.co.uk
If we aren't supposed to eat animals, then why are they made of meat?
If Vegetarians like animals so much, why do they eat all their food?
-
Thanks all .
Lexicon,Fraggs
thanks
-
Who, What, Why ... ?
Cheers for that Lexicon, I wasn't to sure of it myself but seeing as nobody else appeared to be posting I thought I'd give it a go. The worst that could happen was I'd be wrong, which I was. :P
At least I know for future reference though.
Cheers
Regards,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|