9 Replies Latest reply on Aug 30, 2006 7:51 PM by NSurveyor

    Visible if /else on contact form page

    MultiMedia13
      Been trying most of the day to get my code to work it's on an action layer and the comp_mc I would like to appear if the user has not filled in the required info or the thank_mc to appear if the have filled in the correct fields and the message was sent. I have the two clips on the stage one with an instance name of comp_mc and the other named thank_mc. When I test the movie comp_mc and thank_mc ARE invisible as expected. But when i click on the submit button neither one shows up. I can put

      submit_btn._visible = false; in place of comp_mc._visible = false;

      and sure enough when I click the submit button the submit button dissappears! So, what am I doing wrong that is causing my comp_mc and thank_mc not to appear?
      Thanks in advance

      stop();
      comp_mc._visible = false;
      thank_mc._visible = false;
      submit_btn.onRelease = function() {
      if (name_txt.text == "" or email_txt.text == "" or message_txt.text == "") {
      comp_mc._visible = true;
      stop();
      }
      else {
      sendMsg.email = email_txt.text;
      sendMsg.name = name_txt.text;
      sendMsg.name2 = name2_txt.text;
      sendMsg.comp = comp_txt.text;
      sendMsg.tele = tele_txt.text;
      sendMsg.fax = fax_txt.text;
      sendMsg.message = message_txt.text;
      sendMsg.sendAndLoad("xxxxx.php", sendMsg);
      thank_mc._visible = true;
      submit_btn._visible = false;
      }
      };
      var sendMsg:LoadVars = new LoadVars();

        • 1. Re: Visible if /else on contact form page
          injpix Level 3
          EEEeeeyeah! The logical “or” deprecated since Flash 5! Replace your “or” with “||”. Like this;
          if ((name_txt.text == "") || (email_txt.text == "") || (message_txt.text == ""))
          • 2. Re: Visible if /else on contact form page
            MultiMedia13 Level 1
            WOW! Thanks for helping with my question! Oh, wait....you didn't. Funny, that old "or" has been chugging out email for quite some time. I will change that. I am COMPLETELY new to Flash and have been reading and learning as I progress. And yes this is a template that a client insisted on having So I am learning as I go. Guess you never been there before. The one thing that I have learned is that these templates are really, really are out of whack in more ways than one and it's been a great learning experience in what not to do and how to learn how things are done now. Anyway, back to my original question, if you are THAT experienced in coding why didn't you offer a suggestion to what I am trying to achieve? Cutting down my experience really doesn't help at all. But I guess that didn't matter to you. Thanks for the info and I hope the next reply to my original question is as "helpful" but at least stays to the point OF the question. I don't mind "hey, that code is so old, you should change it. Or that "or" is depreciated and as for your original question here's what I would do..." just trying to learn. Thought that's what these forums were for.
            • 3. Re: Visible if /else on contact form page
              injpix Level 3
              “Guess you never been there before.”
              No, I have been there before. Do you think that I inherited ActionScript skills from my parents?

              “Anyway, back to my original question, if you are THAT experienced in coding why didn't you offer a suggestion to what I am trying to achieve?”
              First of all, when and where did I ever say that I am “experienced” in coding? And second of all, what makes you think that I or anyone in this forum is SUPPOSE to offer YOU a suggestion on what you are trying to achieve?

              “Cutting down my experience really doesn't help at all.”
              And again, where is it in my last past did I offended you? “EEEeeeyeah” is an expression I just came up. I had no intention in insulting you by it. It was more of a “shock” expression…I guess.

              “But I guess that didn't matter to you.”
              At the time and currently I have no intention in doing so.

              “Thanks for the info and I hope the next reply to my original question is as "helpful" but at least stays to the point OF the question.”
              Do you really think I am going to sacrifice my time to hear more of your derogatory comments?

              “I don't mind "hey, that code is so old, you should change it. Or that "or" is depreciated and as for your original question here's what I would do..." just trying to learn.”
              You’re asking for help. Now your telling us how you want that advice offered to you!? Do you realize how ignorant that is? Not only are you asking for help but on a free public forum.

              “Thought that's what these forums were for.”
              I think your overacting on this whole subject. You claimed that you worked on this all day, well I also worked on ActionScript all day and didn’t accomplish anything. It’s frustrating at times. I understand this and so do you.
              Unless there is a meaning for “EEEeeeyeah” that is insulting which I have yet to find, although I did find it in some song lyrics, I am sorry.
              • 4. Re: Visible if /else on contact form page
                MultiMedia13 Level 1
                “Guess you never been there before.”
                No, I have been there before. Do you think that I inherited ActionScript skills from my parents?

                Nope, neither did I that's why I was hoping for some constructive advice on the question I originally posted.

                “Anyway, back to my original question, if you are THAT experienced in coding why didn't you offer a suggestion to what I am trying to achieve?”
                First of all, when and where did I ever say that I am “experienced” in coding? And second of all, what makes you think that I or anyone in this forum is SUPPOSE to offer YOU a suggestion on what you are trying to achieve?

                Apparently you were trying to suggest that I was using OLD coding that should be looked at and changed granted. A sign that you might know what you are doing as far as coding... I am humble enough to admit I don't know what I am doing well by posting a question here on the forum. But you offered no suggestion on what I am doing wrong on the actual question i posted.
                And while on this quote when did I ever say someone was SUPPOSED to offer me a suggestion? I asked a question which you did not even attempt to read other than looking at my ancient code from some web bought template. I asked a question, not asked to be ridiculed by you on code I am trying to learn.

                “Cutting down my experience really doesn't help at all.”
                And again, where is it in my last past did I offended you? “EEEeeeyeah” is an expression I just came up. I had no intention in insulting you by it. It was more of a “shock” expression…I guess.

                In your last past? As long as we are nit picking... I assume that would be in my last post...sorry your coding (your spelling is way wrong the a in spelling post is now depreciated has been since the dawn of time) shocking. I am not looking for shock expressions just some help with the original question I posted. Or "pasted" in your case.

                “But I guess that didn't matter to you.”
                At the time and currently I have no intention in doing so.

                Funny doing what, or not doing what? Kind of reminds me of your original "answer to my question", really no help at all.

                “Thanks for the info and I hope the next reply to my original question is as "helpful" but at least stays to the point OF the question.”
                Do you really think I am going to sacrifice my time to hear more of your derogatory comments?

                Nope but I'll bet you sacrifice time reply to this post due to the nature and the fact that what you posted was in your mind not considered derogatory towards me in your mind but my reply was? Once again funny. I just asked a question which is what I thought this forum was about. Just trying to solve a problem and thought the brains on here might pick up my post and have a suggestion to where I might try to take this to make it work. Never expected anyone to write code for me just trying to learn more and how.

                “I don't mind "hey, that code is so old, you should change it. Or that "or" is depreciated and as for your original question here's what I would do..." just trying to learn.”
                You’re asking for help. Now your telling us how you want that advice offered to you!? Do you realize how ignorant that is? Not only are you asking for help but on a free public forum.

                Why even reply to the post if you can't offer some insight on the original question is all I was saying. To post and offer no help but EYEYEYE that code is old as dirt really WAS a waste of your time. Once again funny, advice on the question at hand would have been all that was needed. You took it on yourself to point out depreciated code that I am not familiar with and offer no real suggestion to how to go about doing what my original question asked. I find that ignorant and just petty or looking for a good FLAME to start. My referral to the code I put up I know is WAY dated and was bought from some template website. Had my question been why is this coding so messed up and what needs to be updated I could see your reply coming through loud and clear. But that wasn't my question. I am working on updating the coding and trying to learn more about Actionscript as I go.

                “Thought that's what these forums were for.”
                I think your overacting on this whole subject. You claimed that you worked on this all day, well I also worked on ActionScript all day and didn’t accomplish anything. It’s frustrating at times. I understand this and so do you.
                Unless there is a meaning for “EEEeeeyeah” that is insulting which I have yet to find, although I did find it in some song lyrics, I am sorry.

                Well, I have posted before and had great results. Never Begged, never thought someone was SUPPOSED to answer me, never triple posted the same question, never reamed someone when their suggestion didn't work, or replied to someone if I didn't have an answer to their question. Overacting? Nope I just posted a question that I I guess is now pointless and from the way this thread has gone will never get a real reply.

                Just thought someone here could help. Sorry for taking up so much of all of your (as myIP seems to speak for the whole forum when he/she said "us" in his/her post) time. I will look elsewhere for a solution.
                • 5. Re: Visible if /else on contact form page
                  NSurveyor
                  Updating code that has deprecated code is always a good idea. Sometimes it could even solve the problem (e.g. using 'add' in FP8).

                  "The evolution of ActionScript has deprecated many elements of the language. This section lists the deprecated items and suggests alternatives when available. While deprecated elements still work in Flash Player 8, Macromedia recommends that you do not continue using deprecated elements in your code. Support of deprecated elements in the future is not guaranteed."

                  So I would say myIP's response was very useful.

                  Getting to the problem.... you say the code is located on a frame AND comp_mc yet you provided one script? Can you clearly describe the hierarchy of your clips and where your script(s) are going?

                  I'm guessing submit_btn is inside a clip that is in the same timeline as your two mcs. And thus, you would need _parent.comp_mc and _parent.thank_mc inside the onRelease handler. But this is just a hunch.
                  • 6. Re: Visible if /else on contact form page
                    MultiMedia13 Level 1
                    Hi and thank you NSurveyor,
                    Well I did change the or to || and I understand that depreciated code may or may not work in the future. Anyway, here's how it's set up. I have 5 frames all of which are pages in the site. Frame 4 has the contact page which is a content layer, that has the submit button, a reset button, the MC for the input text fields, and text for the page. On a layer above that I have placed my comp_mc and thank_mc, and a layer above that is the actions layer that includes the script that I posted above. I have on other pages used the script to show a vid_pix_mc and it works fine like this:

                    On the main action layer
                    stop();
                    vid_pix._visible = false;
                    vid_pix2._visible = false;
                    vid_pix3._visible = false;
                    vid_pix4._visible = false;

                    //To hide the vid_pix

                    On the button
                    on(Release){
                    vid_pix._visible = true;
                    vbtn1._visible = false;
                    vbtn2._visible = false;
                    }
                    //to invoke the vid_pix

                    In the vid_pix MC
                    on(Release){
                    _parent.vid_pix._visible = false;
                    _parent.vbtn1._visible = true;
                    _parent.vbtn2._visible = true;
                    }
                    //To close the vid_pix clip.

                    So, I guess what I was trying to do is have the mailing code I posted above invoke the comp_mc IF the user did not fill in the required fields ELSE make visible the thank_mc if they did fill out everything and the message went through. Bypassing the submit button.

                    Now, I am seeing that I may need to find out a way to code the submit button to somehow track what's going on in the mailing code on the action layer and react accordingly. Showing comp_mc when info is not complete and thank_mc if the info is filled in. I do know that the comp_mc._visible = false; is doing it's part on the main action layer. But the comp_mc._visible = true; inside the IF statement is not working.
                    • 7. Re: Visible if /else on contact form page
                      NSurveyor Level 2
                      In your last post you say that there is an "MC for the input text fields". In your original post, you are not looking within this MC for those fields..., thus giving name_txt.text == undefined (which is not empty string)... But even so, the visibility should be changed in the else. The only problem I can possibly see is if there is some other script that is causing the two clips to have false for _visible. Try this for the onRelease handler:

                      submit_btn.onRelease = function() {
                      trace(name_txt.text);
                      trace(email_txt.text);
                      trace(message_txt.text);
                      trace(thank_mc);
                      trace(submit_btn);
                      }

                      See if any of the references turn up undefined to make sure you have your paths right.

                      If the problem still persists, you can email me your .fla at saif7463@gmail.com
                      • 8. Re: Visible if /else on contact form page
                        MultiMedia13 Level 1
                        EXCELLENT! You have made the day, two days for that matter! I was chasing the comp_mc around so much thinking it was the culprit when all along it was the input text. Ii is set up in there to have it say "your name" be setting there where the user would type his/her name. So, in fact the fields were filled out by the code and the comp_mc didn't have to come up! I replaced the "" in the If statement with "your name" etc. and it works like a charm, comp_mc AND thank_mc behave just how I had wanted. Thank you so much for taking the time to rattle my brain you have been a tremendous help.