14 Replies Latest reply on Apr 25, 2006 4:36 PM by Newsgroup_User

    conditional statements using variables

    elmson
      i had to change my instance names to variables to get my form to work but when i changed them the if () statements no longer worked which makes sense.

      So how do i make the statements with the variables?

      thanks for any help
        • 2. Re: conditional statements using variables
          elmson Level 1
          this.b1.onRelease = function() {
          if (theEmail.text == null || theEmail.text =="" || theName.text == null || theName.text =="" || homePhone.text == null || homephone.text =="" ){
          gotoAndStop("error");


          that was the old stuff that is no longer working.
          • 3. Re: conditional statements using variables
            elmson Level 1
            let me repharse the question....

            i dont want any to be able to proceed without filling out the fields in the form ( i dont want to receive a blank form). so my question is how do i do this with variables and not instance names?
            • 4. Re: conditional statements using variables
              C-Rock Level 2
              try setting the first one with an if statement for just theEmail.text == "". then make each one of the others by itself inside and else if statement. and put your error code in an else statement, it should work fine...
              • 5. Re: conditional statements using variables
                elmson Level 1
                thanks for the reply CRock...

                ok now if i use "" it will send the information every time . even if it is blank it will not go to the error screen. and if i use null it goes to the error screen every time even when it is filled out.

                what should i do about this?
                • 6. Re: conditional statements using variables
                  C-Rock Level 2
                  mmmm, i've had lots of trouble with doing this as well. in fact i just spent a few hours getting mine to work yesterday. try using another one for the if.

                  essentially you're saying check then and then this and then this and if they all pass go to the else statement.

                  also it's helpful to trace a hint for yourself inside of each statement. so if it goes there you know it went there. maybe try using the != statement if you can and see if that helps.

                  for some reason i've always had trouble with if else statement in flash. i'm an expert in c language and AS doesn't seem to work exactly the same.

                  let me know if you need anymore help, good luck...
                  • 7. Re: conditional statements using variables
                    Level 7
                    AS does work just like C/C++ if/else ..

                    if (you can write if in C) {
                    you can write in AS;
                    } else {
                    you need to learn;
                    }
                    --
                    Jeckyl


                    • 8. Re: conditional statements using variables
                      elmson Level 1
                      what would i set the != to cause i just want something to be there?

                      in other words how do i say if there is anything in this field go to the next part?
                      • 9. Re: conditional statements using variables
                        elmson Level 1
                        nevermind... just change around the if and the else
                        • 10. Re: conditional statements using variables
                          C-Rock Level 2
                          Hey Jackyl if you're gonna be a dick you need to go somewhere else and be a dick. I've been using flash for 5 years and I'm very good at it. You can't speak of how other people's versions of flash work. I'm just trying to help someone, maybe you should answer some questions instead of being rude! I know I've created if else statements and they don't always work as they are supposed to. If you'd like to see my code I can show you since you seem to know everything.

                          As for the polite people, elmson...

                          I hope that works for you, again I'm not sure while sometimes the code will not work and simply changing the parameters changes it all.... who knows...
                          • 11. Re: conditional statements using variables
                            elmson Level 1
                            i dont know what the problem is i tryed != and that didnt do it and i tryed to use undefined and tht didnt do it..

                            is there anything else that might get it working?
                            • 12. Re: conditional statements using variables
                              C-Rock Level 2
                              here's the code posted on my register for account page. this code is for the button at the bottom of the page.

                              i always use the name of the text input box as somethingTxt and the variable name for that same box as somethingBox.

                              • 13. Re: conditional statements using variables
                                elmson Level 1
                                well it took a while but i got it. thanks for taking the time to help out CRock

                                i used the if else statements like you did and i changed a few other things. the code is slopy but its working

                                thanks again for all the help


                                • 14. Re: conditional statements using variables
                                  Level 7
                                  > Hey Jackyl if you're gonna be a dick you need to go somewhere else and be
                                  > a
                                  > dick.

                                  All I said was that if/else work the same in AS and C, whereas you claim
                                  that it doesn't. Maybe your fragile ego is bruised by that, but its no
                                  reason for starting on the insults. Very sad.

                                  Unless if was my little pseudocode that says if you can with ifs using C,
                                  you can do it in AS. If not, then you need to learn how to write them.

                                  I don't see any dickiness in any of that ... maybe its just you ... I guess
                                  some people just have no sense of humour.

                                  To reiterate more verbosely ... if/else is the same syntax in both C and
                                  Flash .. if you are having problems with it, and you are competent with
                                  using it in C (an 'expert' you claim) .. then its not the if/else itself
                                  that is the problem .. there must be something else you don't understand or
                                  are doing wrong.

                                  > You can't speak of how other people's versions of flash work.

                                  What are you on about? I didn't speak of how other peoples version of Flash
                                  work ... do you also have problems with reading simple messages, as well as
                                  writing if/else statements? All I said was the if/else in AS and C/C++ work
                                  the same way.

                                  > maybe you should answer some questions instead of being rude

                                  I do, thanks very much, quite a lot actually .. do you? I suggest you take
                                  some lessons on what rudeness is yourself. Oh, sorry, you don't need to ..
                                  I see you're already really an expert.

                                  > can show you since you seem to know everything.

                                  You're the one proclaiming yourself as an expert programmer .. yet you can't
                                  even get something as simple as an if/else to work, even though its the same
                                  as in C/C++. Hmm.
                                  --
                                  Jeckyl