8 Replies Latest reply on Nov 6, 2006 11:36 AM by Leegee3

    Making Sprites visible on seperate frames

    Leegee3
      Hi. Im trying to get my head around this and it is doing my head in.

      For example, while in frame 1 I want to be able to click a button which will then make a sprite visible in frame 10, which is a different page, i.e the sprite is only in frame 10 and the button is only in frame 1.

      If they were on the same page I could use...

      on mouseup me
      sprite("1").visible=true
      end

      but because they are on different frames to one another it tells me there is a property error with "visible". I need to make the function global some how but not sure how to do this.


      PLEASE HELP


      Lee
        • 1. Re: Making Sprites visible on seperate frames
          Level 7
          Set a global variable in your mouseUp handler then use that variable's state
          to set the visible of the sprite in frame 10 in its beginSprite handler

          -- put this in a movie script
          global gSetVis

          on StartMovie
          gSetVis = FALSE
          end

          -- integrate this into the script/behavior for the button
          global gSetVis

          on mouseUp me
          gSetVis = FALSE
          end

          --Then in frame 10 on the sprite that needs to be made visible

          global gSetVis

          on beginSprite me
          sprite (me.spriteNum).visible = gSetVis
          end

          --
          Craig Wollman
          Word of Mouth Productions

          phone 212 928 9581
          fax 212 928 9582
          159-00 Riverside Drive West #5H-70
          NY, NY 10032
          www.wordofmouthpros.com


          "Leegee3" <webforumsuser@macromedia.com> wrote in message
          news:eidcn4$be8$1@forums.macromedia.com...
          > Hi. Im trying to get my head around this and it is doing my head in.
          >
          > For example, while in frame 1 I want to be able to click a button which
          > will
          > then make a sprite visible in frame 10, which is a different page, i.e the
          > sprite is only in frame 10 and the button is only in frame 1.
          >
          > If they were on the same page I could use...
          >
          > on mouseup me
          > sprite("1").visible=true
          > end
          >
          > but because they are on different frames to one another it tells me there
          > is a
          > property error with "visible". I need to make the function global some
          > how but
          > not sure how to do this.
          >
          >
          > PLEASE HELP
          >
          >
          > Lee
          >


          • 2. Re: Making Sprites visible on seperate frames
            Leegee3 Level 1
            Hey "WOMP". I hate to be a pain but...

            After trying that code, both the button and the sprite dissapear from the stage. Maybe im doing something wrong but I copied and pasted the lingo from your reply.

            I have director setup in default mode, and I am doing the script in Lingo and not Java, is that correct.


            Lee
            • 3. Re: Making Sprites visible on seperate frames
              Level 7
              It sounds like you put the third piece of code on the button and not the
              sprite that's to be made invisible.

              --
              Craig Wollman
              Word of Mouth Productions

              phone 212 928 9581
              fax 212 928 9582
              159-00 Riverside Drive West #5H-70
              NY, NY 10032
              www.wordofmouthpros.com


              "Leegee3" <webforumsuser@macromedia.com> wrote in message
              news:eidpg4$psb$1@forums.macromedia.com...
              > Hey "WOMP". I hate to be a pain but...
              >
              > After trying that code, both the button and the sprite dissapear from the
              > stage. Maybe im doing something wrong but I copied and pasted the lingo
              > from
              > your reply.
              >
              > I have director setup in default mode, and I am doing the script in Lingo
              > and
              > not Java, is that correct.
              >
              >
              > Lee
              >


              • 4. Re: Making Sprites visible on seperate frames
                Level 7
                On Fri, 03 Nov 2006 13:49:24 GMT, Word of Mouth Productions posted in
                macromedia.director.lingo:

                > It sounds like you put the third piece of code on the button and not the
                > sprite that's to be made invisible.

                I would also suggest adding an endSprite event to that behavior to reset the
                visible property (it's a sprite channel property).

                global gSetVis

                on beginSprite me
                sprite (me.spriteNum).visible = gSetVis
                end

                on endSprite me
                sprite (me.spriteNum).visible = TRUE
                end


                --
                Mark A. Boyd
                Keep-On-Learnin' :)
                • 5. Re: Making Sprites visible on seperate frames
                  Level 7
                  good catch...oversite on my part.

                  Although there have been times and it might very well have been only in a
                  previous version of Director where I'd see the sprite pop onto the screen
                  just before navigating out of the sprite span that had the endSprite/visible
                  handler. I don't remember how I solved it or why it was happening.

                  --
                  Craig Wollman
                  Word of Mouth Productions

                  phone 212 928 9581
                  fax 212 928 9582
                  159-00 Riverside Drive West #5H-70
                  NY, NY 10032
                  www.wordofmouthpros.com


                  "Mark A. Boyd" <mblist@sanDotrr.com.invalid> wrote in message
                  news:Xns987059FA29CEFmblistssanDotrrcom@216.104.212.96...
                  > On Fri, 03 Nov 2006 13:49:24 GMT, Word of Mouth Productions posted in
                  > macromedia.director.lingo:
                  >
                  >> It sounds like you put the third piece of code on the button and not the
                  >> sprite that's to be made invisible.
                  >
                  > I would also suggest adding an endSprite event to that behavior to reset
                  > the
                  > visible property (it's a sprite channel property).
                  >
                  > global gSetVis
                  >
                  > on beginSprite me
                  > sprite (me.spriteNum).visible = gSetVis
                  > end
                  >
                  > on endSprite me
                  > sprite (me.spriteNum).visible = TRUE
                  > end
                  >
                  >
                  > --
                  > Mark A. Boyd
                  > Keep-On-Learnin' :)


                  • 6. Re: Making Sprites visible on seperate frames
                    Level 7
                    On Sat, 04 Nov 2006 12:36:52 GMT, Word of Mouth Productions posted in
                    macromedia.director.lingo:

                    > Although there have been times and it might very well have been only in
                    > a previous version of Director where I'd see the sprite pop onto the
                    > screen just before navigating out of the sprite span that had the
                    > endSprite/visible handler. I don't remember how I solved it or why it
                    > was happening.

                    That /might/ be why I set the sprite loc to off-stage coordinates instead. I
                    don't recall the details, either.


                    --
                    Mark A. Boyd
                    Keep-On-Learnin' :)
                    • 7. Re: Making Sprites visible on seperate frames
                      Level 7
                      I believe that might have been my solution as well. And it avoids having to
                      reset the visible.

                      For anyone other than Mark who is interested.

                      property pStageLoc, pOffstageLoc

                      on beginSprite me
                      pStageLoc = sprite (me.spriteNum).loc
                      pOffstageLoc = point (3000, 3000)
                      sprite (me.spriteNum).loc = pOffstageLoc
                      end

                      Now you can set it off stage or on stage and always trust that it will be
                      back in its starting position and you won't see the sprite when the frame
                      first displays since you're setting it offstage in the beginSprite handler.


                      --
                      Craig Wollman
                      Word of Mouth Productions

                      phone 212 928 9581
                      fax 212 928 9582
                      159-00 Riverside Drive West #5H-70
                      NY, NY 10032
                      www.wordofmouthpros.com


                      "Mark A. Boyd" <mblist@sanDotrr.com.invalid> wrote in message
                      news:Xns9871578FB9FCBmblistssanDotrrcom@216.104.212.96...
                      > On Sat, 04 Nov 2006 12:36:52 GMT, Word of Mouth Productions posted in
                      > macromedia.director.lingo:
                      >
                      >> Although there have been times and it might very well have been only in
                      >> a previous version of Director where I'd see the sprite pop onto the
                      >> screen just before navigating out of the sprite span that had the
                      >> endSprite/visible handler. I don't remember how I solved it or why it
                      >> was happening.
                      >
                      > That /might/ be why I set the sprite loc to off-stage coordinates instead.
                      > I
                      > don't recall the details, either.
                      >
                      >
                      > --
                      > Mark A. Boyd
                      > Keep-On-Learnin' :)


                      • 8. Re: Making Sprites visible on seperate frames
                        Leegee3 Level 1
                        Just wanted to say thanks. I got it working with the help from you guys.

                        Thanks again,


                        Lee