9 Replies Latest reply on Oct 9, 2008 12:14 AM by Newsgroup_User

    call a handler in Flash

    Level 7
      Hello:
      Do you know how to do this?

      On MouseUp me
      playFlashHandler
      end

      I mean, to call a Flash handler when push a button in Director
      Thank you very much.


        • 1. Re: call a handler in Flash
          Level 7
          Depending on where your handler is located (in which timeline in Flash,
          given its movieClip paradigm) it could be as simple as:
          --
          on mouseUp me
          sprite("flash").playFlashHandler()
          end
          • 2. Re: call a handler in Flash
            Level 7
            Thank you very much.

            I get an error in Director "handler not found in object"

            I have this in Flash:

            on (release) {
            myBook.flipGotoPage(0);
            }

            in Director I write:
            on mouseUp me

            sprite("flash").myBook.flipGotoPage(0)


            end




            • 3. Re: call a handler in Flash
              Level 7
              I really need to call to: myBook.flipGotoPage(0);
              and no On (release).
              Thank you

              "Arielle" <Arielle@hotmail.com> escribió en el mensaje
              news:gci1o7$hke$1@forums.macromedia.com...
              > Thank you very much.
              >
              > I get an error in Director "handler not found in object"
              >
              > I have this in Flash:
              >
              > on (release) {
              > myBook.flipGotoPage(0);
              > }
              >
              > in Director I write:
              > on mouseUp me
              >
              > sprite("flash").myBook.flipGotoPage(0)
              >
              >
              > end
              >
              >
              >
              >


              • 4. call a handler in Flash
                Chunick Level 3
                look closely at what you wrote:
                on mouseUp me
                sprite("flash").myBook.flipGotoPage(0)
                end

                did you attach that script to the proper sprite? With the "me" at the end of the handler that would suggest you attached it as a behavior to a sprite acting like a button. Did you name the sprite "flash"? Naming has only been allowed since Director MX2004 and the most direct way to name the sprite is thru the Property Inspector in the Sprite tab in the field labelled "Name". If you haven't named your sprite then use it's sprite number instead. It's sprite number corresponds with the channel it's in... if it's a behavior script then you can use a special reference to itself and that way you do not have to hard code the sprite number... this saves most developers from making the mistake of hard coding the sprite number in a behavior script and then moving the sprite later... then their sprite number would be different and their code not work.... so, give this a try next:

                on mouseUp me
                sprite(me.spriteNum).myBook.flipGotoPage(0)
                end

                That won't necessarily fix everything, but it should now be correct providing our other assumption that it's been attached as a behavior script to a sprite is correct - and should help you move forward a bit more.
                • 5. Re: call a handler in Flash
                  Level 7
                  Thank you.

                  I get other error: "property not found"
                  #mybook


                  • 6. Re: call a handler in Flash
                    Level 7
                    I used sprite("flash") as an example, hoping you would understand the
                    general principle.

                    In which channel (what sprite number) do you have your Flash sprite? Is
                    the behavior containing the mouseUp handler attached to the Flash
                    sprite, or to a button on your stage?
                    • 7. Re: call a handler in Flash
                      Level 7
                      Thank you.

                      > In which channel (what sprite number) do you have your Flash sprite?
                      ----------------- sprite(1).myBook.flipGotoPage(0)


                      Is the behavior containing the mouseUp handler attached to the Flash
                      > sprite, or to a button on your stage?

                      ------------------ is in a button on my stage (Director)

                      the handler in Flash is flipGotoPage(paramater) attached to a movieclip
                      myBook


                      • 8. Re: call a handler in Flash
                        Level 7
                        > ----------------- sprite(1).myBook.flipGotoPage(0)

                        With your movie running, open your Object Inspector and add 'sprite(1)'
                        (without quotes) into the inspector. You should be able to expand the
                        sprite's properties and drill down to confirm you have a movieClip named
                        "myBook".

                        If you are still having trouble, could you upload the Flash swf
                        somewhere so that we can take a look?
                        • 9. Re: call a handler in Flash
                          Level 7
                          Ok thank you.
                          Well I'm thinking another thing.

                          in Flash, this works perfectly:

                          on (release) {
                          myBook.flipGotoPage(0);
                          }

                          Can I push that button (that it is in Flash) from Director?



                          "Sean Wilson" <webforumsuser@macromedia.com> escribió en el mensaje
                          news:gcjb4i$afv$1@forums.macromedia.com...
                          >> ----------------- sprite(1).myBook.flipGotoPage(0)
                          > nd
                          > With your movie running, open your Object Inspector and add 'sprite(1)'
                          > (without quotes) into the inspector. You should be able to expand the
                          > sprite's properties and drill down to confirm you have a movieClip named
                          > "myBook".> If you are still having trouble, could you upload the Flash swf
                          > somewhere so that we can take a look?