6 Replies Latest reply on Jul 19, 2007 3:47 PM by Newsgroup_User

    Plse help with btn.onRelease error message

    chez_Lou
      Hi
      Using Flash Prof. v 8
      On a slide in a presentation, I have the following script to print a movieClip (print1) using a button (btn1):

      btn1.onRelease = function() {
      var pj = new PrintJob();
      var success = pj.start();
      if(success)
      {
      pj.addPage("print1");
      pj.send();
      }
      delete pj;
      }

      When I publish, I get the following error:
      **Error** Screen=slide16:Line 10: Statement must appear within on/onClipEvent handler
      btn1.onRelease = function()
      Total ActionScript Errors: 1 Reported Errors: 1

      The button and movieclip both have an instance name.
      The swf presentation plays fine, the movieclip prints fine.
      I just don't undersand why I get that action script error. Any ideas?

      Please help so I can move on to figure out my other issues, ha!
        • 1. Re: Plse help with btn.onRelease error message
          Level 7
          Hi chez Lou,

          This is Flash telling you that the code you have there is on the button
          instance, not on the timeline. Click on the button and hit F9 (or open
          the actions panel). The script is there, right? You either do need to
          put it into an on() {} block or cut and paste it into the frame code --
          select the frame, hit F9 (or open actions) and paste.

          Regards,
          Patrick

          chez Lou wrote:
          > Hi
          > Using Flash Prof. v 8
          > On a slide in a presentation, I have the following script to print a
          > movieClip (print1) using a button (btn1):
          >
          > btn1.onRelease = function() {
          > var pj = new PrintJob();
          > var success = pj.start();
          > if(success)
          > {
          > pj.addPage("print1");
          > pj.send();
          > }
          > delete pj;
          > }
          >
          > When I publish, I get the following error:
          > **Error** Screen=slide16:Line 10: Statement must appear within on/onClipEvent
          > handler
          > btn1.onRelease = function()
          > Total ActionScript Errors: 1 Reported Errors: 1
          >
          > The button and movieclip both have an instance name.
          > The swf presentation plays fine, the movieclip prints fine.
          > I just don't undersand why I get that action script error. Any ideas?
          >
          > Please help so I can move on to figure out my other issues, ha!
          >
          • 2. Re: Plse help with btn.onRelease error message
            edgarTL Level 1
            Chez,

            is is possible that the script above was accidentally placed on the slide itself and not on frame 1 of slide 16?

            Generally, that error states you have a frame style script on an object - meaning some code is somewhere on an object and not within an event handler.

            if everything is working - then it might not be the script you posted but some other script remnant on a slide someplace.

            Hope that helps
            • 3. Re: Plse help with btn.onRelease error message
              chez_Lou Level 1
              lonerhino - thanks for the response.

              Everything on that slide is on frame 1, just different layers.

              I thought I had the script on its own layer, the mc to print on a separate layer, and the buttons yet on another layer.

              Based on what you said, I'm trying to make sure that's the case.

              Strange thing is, no matter what I do, when I try and insert the script on its own layer, it gets attached to the layer on which the buttons are. even though that layer is locked, and I am on the *dedicated* scripts layer, with keyframe and all, when I insert the code.

              Is this normal, or is my app buggy, or am I really missing something??
              • 4. Re: Plse help with btn.onRelease error message
                Level 7
                Hi chez Lou,

                This does sound like a bug and one that I've experienced in the past.
                I'd recommend re-starting Flash and possibly your computer. This should
                definitely not be happening.

                Regards,
                Patrick

                ---
                http://www.baynewmedia.com

                Faster, easier, better...ActionScript development taken to new heights.

                Download the BNMAPI today. You'll wonder how you ever did without it!

                Available for ActionScript 2.0/3.0.

                chez Lou wrote:
                > lonerhino - thanks for the response.
                >
                > Everything on that slide is on frame 1, just different layers.
                >
                > I thought I had the script on its own layer, the mc to print on a separate
                > layer, and the buttons yet on another layer.
                >
                > Based on what you said, I'm trying to make sure that's the case.
                >
                > Strange thing is, no matter what I do, when I try and insert the script on its
                > own layer, it gets attached to the layer on which the buttons are. even though
                > that layer is locked, and I am on the *dedicated* scripts layer, with keyframe
                > and all, when I insert the code.
                >
                > Is this normal, or is my app buggy, or am I really missing something??
                >


                --

                • 5. Re: Plse help with btn.onRelease error message
                  chez_Lou Level 1
                  Thanks Patrick.
                  I have experienced a few other *weird* things, which also feel buggy, but being new to ActionScript I of course think first about everything I might have done wrong.

                  I have the upgrade to CS3 still in box (windows pc), would you recommend I install that, or do I risk getting into more bugs?
                  • 6. Re: Plse help with btn.onRelease error message
                    Level 7
                    I don't think it would hurt. It can handle Flash 8 and runs better than
                    the Flash 8 IDE, IMHO. It seems more stable (C3, I mean) so I would
                    recommend it. But this isn't a rampant error so it's not absolutely
                    necessary, I think.

                    Regards,
                    Patrick

                    chez Lou wrote:
                    > Thanks Patrick.
                    > I have experienced a few other *weird* things, which also feel buggy, but
                    > being new to ActionScript I of course think first about everything I might have
                    > done wrong.
                    >
                    > I have the upgrade to CS3 still in box (windows pc), would you recommend I
                    > install that, or do I risk getting into more bugs?
                    >

                    --
                    http://www.baynewmedia.com
                    Faster, easier, better...ActionScript development taken to new heights.
                    Download the BNMAPI today. You'll wonder how you ever did without it!
                    Available for ActionScript 2.0/3.0.