1 Reply Latest reply on Aug 17, 2007 6:12 PM by Newsgroup_User

    fading in a sprite

    ddok Level 1
      Hi there,

      i want to fade in a couple a couple of sprites but the fadein occurs very slowly, anyone know how to speed it up a bit?


      property, my
      on enterframe me
      my=(sprite(me.spritenum))

      on mousedown me
      repeat with n = 1 to 100
      sprite(7).blend = n
      sprite(8).blend = n
      sprite(9).blend = n
      my = n
      sprite(7).blend = (1+n)
      sprite(8).blend = (1+n)
      sprite(9).blend = (1+n)
      my = (1+n)

      updateStage
      if n = 100 then go to frame 5

      end repeat
      end
        • 1. Re: fading in a sprite
          Level 7
          Your fade is changing 1% at a time. You also have a repeat loop inside a
          repeating function.

          Try something like this:

          ------------
          property my, increment,animateMe

          on beginSprite me
          my = sprite(me.spriteNum)
          animateMe = false

          end

          on getPropertyDescriptionList
          myPropList = [:]
          myPropList.addProp(increment:[#comment:"set the speed of the
          fade:",#format:#integer,#range:[#min:1,#max:15],#default:5])
          return myPropList
          end

          on mouseDown me
          animateMe = true
          end

          on mouseUp me
          animateMe = false
          end

          on enterFrame me
          if animateMe then
          if sprite(7).blend < 100 then
          sprite(7).blend = sprite(7).blend + increment
          -- repeat as needed
          end if
          end if
          end
          -------------

          There is also a bunch of stuff in your mouseDown function that makes no
          sense at all.


          --
          Rob

          ___________
          Rob Dillon
          Adobe Community Expert
          http://www.ddg-designs.com
          412.243.9119