7 Replies Latest reply on Sep 7, 2007 2:02 PM by kglad

    Flash text component problems

    Travis Coats
      stop();

      //----------------<LoadVars>------------------\\

      var myLoadVars:LoadVars = new LoadVars();

      //----------------</LoadVars>------------------\\



      //----------------<Bluehost>------------------\\

      var Sendtoemail:String = "me@mysite.com";
      var Redirect:String = " http://www.mysite.com";
      var Subject:String = "Music Critique";

      //----------------</Bluehost>------------------\\

      this.invisible_Btn.onRelease = function () {
      gotoAndPlay(main);
      }

      //----------------<Submit Button>------------------\\

      this.contactForm.submit_btn.onRelease = function () {
      trace("Button is working");
      if (contactForm.name_txt.text = "undefined") {
      gotoAndPlay("error");
      trace("Error page working")
      }
      myLoadVars.Name = this.contactForm.name_txt.text;
      myLoadVars.Email = this.contactForm.email_txt.text;
      myLoadVars.Comments = this.contactForm.comments_txt.text;
      myLoadVars.Address = this.contactForm.track_cb.selectedItem.label;<-----this is working for some reason!?!?---->
      myLoadVars.sendtoemail = Sendtoemail;
      myLoadVars.redirect = Redirect;
      myLoadVars.subject = Subject;
      trace(myLoadVars);
      gotoAndPlay(sent);

      }
      This is my output panel no matter what I type in the fields:
      Button is working
      Error page working
      subject=Music%20Critique&redirect=http%3A%2F%2Fwww%2Emysite%2Ecom&sendtoemail=me%mysite%2E com&Address=undefined&Comments=undefined&Email=undefined&Name=undefined
        • 1. Re: Flash text component problems
          kglad Adobe Community Professional & MVP
          use double equal (==) to test for equality. otherwise, you're using the assignment operator (=).
          • 2. Flash text component problems
            Travis Coats Level 1
            replacing it does not allow the validation function to work. I don't know why it is doing it that way but if I use the " is exactly equal to operator", it will skip the function, which is a check on the name_txt field in my form. Even if I leave the text field blank it will still say everything is okay and go to sent function. However, I am not worried about this, I need to know why it is that the above code is coming back with undefined variable values. I tested a small bit of code and commented the rest out, and everything worked fine. so $%^%$%!!! Here is the code:

            this.contactForm.submit_btn.onRelease = function() {
            trace(contactForm.name_txt.text);
            trace(contactForm.email_txt.text);
            trace(contactForm.comments_txt.text);
            trace(contactForm.track_cb.selectedItem.label);

            everything I type in the text fields in recorded as I want. this should be the same thing in my form code?!?! I am very frustrated with it, because I have been working with this problem for months, with no answer. :)\
            I would like to also say that using regular text input fields this works fine and the == operator does it's validation correct. Is there something different about text input components?
            • 3. Re: Flash text component problems
              kglad Adobe Community Professional & MVP
              it works. however, you probably don't want to check if the text property is a string, unless it's "".
              • 4. Flash text component problems
                Travis Coats Level 1
                I changed it and found out the problem, this is the working code with components:

                //----------------<LoadVars>------------------\\

                var myLoadVars:LoadVars = new LoadVars();

                //----------------</LoadVars>------------------\\



                //----------------<Bluehost>------------------\\

                var Sendtoemail:String = "me@mysite.com";
                var Redirect:String = " http://www.mysite.com";
                var Subject:String = "Music Critique";

                //----------------</Bluehost>------------------\\

                this.invisible_Btn.onRelease = function () {
                gotoAndPlay(main);
                }

                //----------------<Submit Button>------------------\\

                this.contactForm.submit_btn.onRelease = function () {
                trace("Button is working");
                if (contactForm.name_txt.text == "" || contactForm.email_txt.text == "" || contactForm.comments_txt == "") {
                gotoAndPlay("error");
                trace("Error page working")
                } else {
                myLoadVars.Name = contactForm.name_txt.text;
                myLoadVars.Email = contactForm.email_txt.text;
                myLoadVars.Comments = contactForm.comments_txt.text;
                myLoadVars.Address = contactForm.track_cb.selectedItem.label
                myLoadVars.sendtoemail = Sendtoemail;
                myLoadVars.redirect = Redirect;
                myLoadVars.subject = Subject;
                trace(myLoadVars.Name);
                trace(myLoadVars.Email);
                trace(myLoadVars.Comments);
                trace(myLoadVars.Address);
                trace(myLoadVars.sendtoemail);
                trace(myLoadVars.redirect);
                trace(myLoadVars.subject);
                myLoadVars.send(" http://www.bluehost.com/bluemail",_blank,POST)
                gotoAndPlay("sent");
                }

                }
                • 5. Re: Flash text component problems
                  kglad Adobe Community Professional & MVP
                  you found the problem?
                  • 6. Re: Flash text component problems
                    Travis Coats Level 1
                    Yes, it seems that the way I was addressing the loaction/target was incorrect. Not quite sure really, but the current code works. Instead of "this.contactForm.name_txt.text"-----it's just----"contactForm.name_txt.text" I am not sure why it works since when youuse target location it was the tool that generated the original code. As long as it works, I am good. Thanks.