4 Replies Latest reply on Jul 24, 2006 6:31 AM by Newsgroup_User

    Control loop times in swf file

    Level 7
      Hello:

      I have a sprite swf its framecount is 45.
      How can control for example a loop three times and after that stop the
      animation?t
      What parameter do I have to test?
      thank you very much


        • 1. Re: Control loop times in swf file
          Level 7
          You could probably test the _currentframe property of the flash sprite
          and count how many times you see 45.

          Something like this might do the job:

          --------
          property mycounter
          property loopcount
          property totalFrames
          property thisSprite

          on getPropertyDescriptionList
          myPropList = [:]
          myProplist.addProp(#loopcount,[#comment:"number of times to
          loop:",#format:#integer,#default:3,#range:[#min:1,#max:10]])
          return myPropList
          end

          on beginSprite me
          thisSprite = me.spriteNum
          totalFrames = sprite(thisSprite)._totalframes
          mycounter = 0
          end

          on exitFrame me
          if sprite(thisSprite)._currentframe = totalFrames then
          mycounter = mycounter + 1
          end if
          if mycounter = loopcount then -- you're done
          sprite(thisSprite).stop() -- or sprite(thisSprite).gotoAndStop(1)
          end if
          end
          ----------

          --
          Rob
          _______
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412-243-9119

          http://www.macromedia.com/software/trial/
          • 2. Re: Control loop times in swf file
            Level 7
            Thank you.
            Can you tell me where do I put and call this behabiours?
            In the frame .There isn't "go to the frame"

            and in the sprite does not work.
            Thanks

            "Rob Dillon - Adobe Community Expert" <rob@-remove-ddg-designs.com> escribi�
            en el mensaje news:rob-51A034.11165323072006@forums.macromedia.com...
            > You could probably test the _currentframe property of the flash sprite
            > and count how many times you see 45.
            >
            > Something like this might do the job:
            >
            > --------
            > property mycounter
            > property loopcount
            > property totalFrames
            > property thisSprite
            >
            > on getPropertyDescriptionList
            > myPropList = [:]
            > myProplist.addProp(#loopcount,[#comment:"number of times to
            > loop:",#format:#integer,#default:3,#range:[#min:1,#max:10]])
            > return myPropList
            > end
            >
            > on beginSprite me
            > thisSprite = me.spriteNum
            > totalFrames = sprite(thisSprite)._totalframes
            > mycounter = 0
            > end
            >
            > on exitFrame me
            > if sprite(thisSprite)._currentframe = totalFrames then
            > mycounter = mycounter + 1
            > end if
            > if mycounter = loopcount then -- you're done
            > sprite(thisSprite).stop() -- or sprite(thisSprite).gotoAndStop(1)
            > end if
            > end
            > ----------
            >
            > --
            > Rob
            > _______
            > Rob Dillon
            > Adobe Community Expert
            > http://www.ddg-designs.com
            > 412-243-9119
            >
            > http://www.macromedia.com/software/trial/


            • 3. Re: Control loop times in swf file
              Level 7

              Thank you.

              the propertie _currentframe does no exist.

              Can you tell me where do I put and call this behabiours?
              In the frame .There isn't "go to the frame"

              and in the sprite does not work.

              Thanks


              • 4. Re: Control loop times in swf file
                Level 7
                change this:

                totalFrames = sprite(thisSprite)._totalframes

                to this:

                totalFrames = sprite(thisSprite).member.frameCount

                --
                Rob
                _______
                Rob Dillon
                Adobe Community Expert
                http://www.ddg-designs.com
                412-243-9119

                http://www.macromedia.com/software/trial/