A Flash Developer Resource Site

Results 1 to 10 of 10

Thread: why this action not working

  1. #1
    Member
    Join Date
    Mar 2002
    Posts
    58

    why this action not working

    button_btn.onRelease= function() {
    if (text_txt=="" ) {
    stop();

    thanks

  2. #2
    The Flashman earl223's Avatar
    Join Date
    Sep 2000
    Location
    Marikina City, Philippines
    Posts
    876
    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

  3. #3
    Flashkit Veteran joejoe2288's Avatar
    Join Date
    Apr 2004
    Location
    Hickville, Oregon
    Posts
    2,554
    also you forgot a '}' at the end
    So tired of all the fighting....

    http://joejoe2288.kawanda.net

  4. #4
    Member
    Join Date
    Mar 2002
    Posts
    58
    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();
    }

  5. #5
    Who, What, Why ... ? Fraggs's Avatar
    Join Date
    Jul 2003
    Location
    Flashland .. where else ?
    Posts
    786
    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,

  6. #6
    Member
    Join Date
    Mar 2002
    Posts
    58
    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");
    }
    }

  7. #7
    Who, What, Why ... ? Fraggs's Avatar
    Join Date
    Jul 2003
    Location
    Flashland .. where else ?
    Posts
    786
    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.

  8. #8
    Monkey Moderator Lexicon's Avatar
    Join Date
    Jul 2001
    Location
    UK
    Posts
    2,038
    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?

  9. #9
    Member
    Join Date
    Mar 2002
    Posts
    58
    Thanks all .


    Lexicon,Fraggs


    thanks

  10. #10
    Who, What, Why ... ? Fraggs's Avatar
    Join Date
    Jul 2003
    Location
    Flashland .. where else ?
    Posts
    786
    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
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center