2 Replies Latest reply on Nov 17, 2007 2:49 PM by Newsgroup_User

    Actionscript PROBLEMS

    Mary_Alice
      Hope that senior member that sent me the script can solve because he was the one that gave the script. I have spent four hours and have not solved it.
      Mary Alice

      This is the error message that comes:

      **Error** Scene=Scene 1, layer=SUBMIT , frame=1:Line 29: Statement must appear within on/onClipEvent handler
      re_lv.onLoad = function(success) {

      **Error** Scene=Scene 1, layer=SUBMIT , frame=1:Line 34: Statement must appear within on/onClipEvent handler
      my_lv.sendAndLoad("analysisformphp.php", re_lv, "POST");

      **Error** Scene=Scene 1, layer=SUBMIT , frame=1:Line 35: Unexpected '}' encountered
      }

      Total ActionScript Errors: 3 Reported Errors: 3**Error** Scene=Scene 1, layer=SUBMIT , frame=1:Line 29: Statement must appear within on/onClipEvent handler
      re_lv.onLoad = function(success) {

      **Error** Scene=Scene 1, layer=SUBMIT , frame=1:Line 34: Statement must appear within on/onClipEvent handler
      my_lv.sendAndLoad("analysisformphp.php", re_lv, "POST");

      **Error** Scene=Scene 1, layer=SUBMIT , frame=1:Line 35: Unexpected '}' encountered
      }

      Total ActionScript Errors: 3 Reported Errors: 3

      See script below sent to me by a senior member. Something is wrong with the near bottom area!? HELP.



        • 1. Re: Actionscript PROBLEMS
          clbeech Level 3
          Mary, both of those methods are suppose to be within the on(release) handler, it looks as though you've added a } after the 'my_lv.email = ...' statement, remove that bracket, this is the reason for all of the above errors.

          this is the way the code is constructed in the original post:
          http://www.adobe.com/cfusion/webforums/forum/messageview.cfm?forumid=15&catid=288&threadid =1315529&enterthread=y
          • 2. Re: Actionscript PROBLEMS
            Level 7
            Mary Alice,

            > This is the error message that comes:
            >
            > **Error** Scene=Scene 1, layer=SUBMIT , frame=1:Line 29:
            > Statement must appear within on/onClipEvent handler

            That message, "Statement must appear within on/onClipEvent handler,"
            means that you have directly attached your code to an object of some kind --
            a button, perhaps, or a movie clip -- without putting that code inside
            either an on() or onClipEvent() handler. There are at least two places to
            put your code in a Flash document (not counting external scripts, which is
            yet another possibility): you can A) put code in the keyframe of a timeline
            or B) attach it directly to an object (in ActionScript 1.0 or 2.0
            documents).

            The selected item determines the placement of your code. If you've
            clicked a keyframe to select it, then the Actions panel is associated with
            the timeline. If you've clicked a button (etc.) to select it, then the
            Actions panel is associated with that object. Any code that appears on an
            object, such as a button, must be contained within one or more of the
            following sorts of statements:

            on (press) {
            // code here
            }
            on (release) {
            // code here
            }
            // etc.

            ... which indicates when the code should execute; that is, in response to
            what event (being pressed by the mouse, being released, and so on). The
            code you've shown is not entirely contained within your on() handler. If it
            were, it might look like this:

            on (release) {
            my_lv = new LoadVariables();
            my_lv.household = _parent.household_txt.text;
            my_lv.water = _parent.water_txt.text;
            my_lv.soft = _parent.soft_txt.text;
            my_lv.bottle = _parent.bottle_txt.text;
            my_lv.comments = _parent.comments_txt.text;
            my_lv.namebus = _parent.namebus_txt.text;
            my_lv.address1 = _parent.address1_txt.text;
            my_lv.address2 = _parent.address2_txt.text;
            my_lv.phone = _parent.phone_txt.text;
            my_lv.email = _parent.email_txt.text;
            re_lv.onLoad = function(success) {
            if (success) {
            getURL(" http://www.ecowaterpb.com/thanks.html");
            }
            }
            my_lv.sendAndLoad("analysisformphp.php", re_lv, "POST");
            }

            Note very carefully how every "{" character has a closing "}" character,
            even when "{}" pairings are nested within each other.


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