1 Reply Latest reply on Jun 15, 2006 1:23 PM by Newsgroup_User

    Change sprite during sound

    Cicero83
      Hi,
      I have a movie with a character that speaks. If you click on a sprite in the stage a sound will play. What I want to do is to display the character with his mouth shut in the beginning. When the sound begins to play, the sprite(with mouth shut) must be replaced with a filmloop. This is not the problem. The problem is that when the sound stops, the filmloop must be replaced with the sprite with his mouth shut.

      I have this script on a sprite that, when if clicked, plays a sound.

      on mouseUp me
      sound(3).play(member("groenegrijzeabak"))
      sprite(24).member = member("praten")
      end

      I hope someone can help me.

      grtz from Holland
        • 1. Re: Change sprite during sound
          Level 7
          You can use an on EnterFrame function to look at your sound file.

          Try this behavior on the control that starts your sound:

          ----------
          property thisSprite
          property spriteToChange
          property normalMember
          property animatedMember
          property soundChannelNumber
          property soundFile
          property soundLength

          on getPropertyDescriptionList
          myPropList = [:]
          myPropList.addProp(#spriteToChange,[#comment:"enter the sprite channel
          number to use:",#format:#integer,#default:""])
          myPropList.addProp(#animatedMember,[#comment:"pick the filmloop to
          use:",#format:#filmLoop,#default:""])
          myPropList.addProp(#soundFile,[#comment:"pick the sound file to
          use:",#format:#sound,#default:""])
          myPropList.addProp(#soundChannelNumber,[#comment:"pick the sound
          channel to use:",#format:#integer,#range:[#min:1,#max:8],#default:2])
          return myPropList
          end

          on beginSprite me
          thisSprite = me.spriteNum
          normalMember = sprite(spriteToChange).member
          sound(soundChannelNumber).queue(member(soundFile))
          soundLength = member(soundFile).duration
          end

          on mouseUp me
          sound(soundChannelNumber).play()
          sprite(spriteToChange).member = member(animatedMember)
          end

          on enterFrame me
          if sound(soundChannelNumber).currentTime >= soundLength then
          sprite(spriteToChange).member = normalMember
          end if
          end
          ---------

          There will probably be a bunch of line wraps that you'll have to sort
          out.

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

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