2 Replies Latest reply on Dec 10, 2007 6:30 AM by SteveH59

    Baffled why it won't work!

    SteveH59 Level 1
      Hello

      I have a contact form with a couple of fields (Name, etc) which has never worked. I am trying to 'see' an ASP file using this script:

      on (release) {
      loadVariables ("flashEmailTest.asp", this._parent, "POST");
      }


      When I click on the form's 'submit' button to send myself a message, nothing happens. If there were something wrong with the ASP script at the other end, wouldn't I get a server error message?

      I did think something was wrong with the 'submit' button itself, so I deleted the above script and inserted this:

      on (release) {

      //Goto Webpage Behavior
      getURL(" http://www.macromedia.com","_self");
      //End Behavior

      }

      Now, when I upload the file and click on 'Submit', I am taken to the Macromedia home page.

      I am right in thinking, am I not, that the 'submit' button works?

      So, If it works, and I get no server error message, the problem I have lies in this:

      on (release) {
      loadVariables ("flashEmailTest.asp", this._parent, "POST");
      }


      When I insert this offline, my Fla file tells me if cannot find the flashEmailTest.asp file (which it would not be able to offline), but at least it is trying to search for it.

      So what am I doing wrong?

      Thanks.

      Steve
        • 1. Re: Baffled why it won't work!
          Level 7
          Steve,

          > When I click on the form's 'submit' button to send myself a
          > message, nothing happens. If there were something wrong
          > with the ASP script at the other end, wouldn't I get a server
          > error message?

          The nice thing about loading variables into Flash is that the mechanisms
          available -- the loadVariables() function, the LoadVars class, and others --
          can be tested independently. If you visit flashEmailTest.asp directly in a
          browser (no Flash), you should see the same string Flash does. That way
          you'll know if the ASP script is working. (In this case, you don't seem to
          be sending any variables -- which is fine -- you're only retrieving them.
          Sometimes there are cases where you want to send variables to the server,
          and in cases like that, you can create a simple HTML form to make the GET or
          POST submission. So it's always something you can test outside of Flash.)

          > I am right in thinking, am I not, that the 'submit' button works?

          If it's a button symbol, it works simply by virtue of being a button
          symbol. The graphics will update as you hover over them, for example, even
          if the button isn't programmed to do anything. What you're asking, I
          believe, is something more along the lines of, "Is on() a reasonable way to
          program a button?" And it certainly is. The on() and onClipEvent()
          functions are old, but they do still work in any version of Flash Player
          that supports ActionScript 2.0. See this brief article for a few thoughts
          on these functions ...

          http://www.quip.net/blog/2006/flash/museum-pieces-on-and-onclipevent

          > So, If it works, and I get no server error message, the problem
          > I have lies in this:
          >
          > on (release) {
          > loadVariables ("flashEmailTest.asp", this._parent, "POST");
          > }

          That may be, so then my question becomes, "How do you know it doesn't
          work?" You're providing three parameters to this function, and the second
          one routes the incoming variables to the parent timeline of this button.
          The use of on() on buttons happens to have an interesting quirk, which might
          be the cause of your troubles in this case. When you use on(), a button
          symbol doesn't really have a sense of self the way you might expect. The
          keyword "this", on a button in this context, actually refers to the button's
          parent -- not the button itself. This changes if you use the dot notation
          approach ...

          buttonInstanceName.onRelease = function():Void {
          loadVariables ("flashEmailTest.asp", this._parent, "POST");
          }

          ... in which case the keyword "this" -- from the point of view of the
          button -- refers to the button itself. In the on() case, the expression
          "this._parent" refers to the parent of the timeline that contains this this
          button. Such a timeline doesn't exist if this button is located directly in
          the main timeline ("this" would point to the main timeline, while
          "this._parent" would be meaningless). Make sense? So you might simply have
          to remove the "._parent" -- but only you will know for sure, and a bit of
          debugging (such as the trace() statement) should help tremendously.

          > When I insert this offline, my Fla file tells me if cannot find the
          > flashEmailTest.asp file (which it would not be able to offline),
          > but at least it is trying to search for it.

          True, and that makes sense. So if you're testing from inside the Flash
          IDE -- so that you can use debugging tools more easily, for example --
          provide the full URL for that ASP page.

          on (release) {
          loadVariables (" http://www.domain.com/flashEmailTest.asp", this._parent,
          "POST");
          }

          Here's an article on debugging in ActionScript 2.0 that may help you see
          what's going on under the hood, so to speak. I wrote this last year, but
          it's still useful for ActionScript 2.0 and even 1.0 documents.

          http://www.adobe.com/devnet/flash/articles/debugging_actionscript.html


          David Stiller
          Co-author, Foundation Flash CS3 for Designers
          http://tinyurl.com/2k29mj
          "Luck is the residue of good design."


          • 2. Re: Baffled why it won't work!
            SteveH59 Level 1
            Hello David

            Very many thanks for your detailed and informative reply - and the links which I have saved.

            I'll digest all what you have said - and the link material - and post back.

            Many thanks again.

            Steve