5 Replies Latest reply on Mar 17, 2010 12:29 PM by Sean_Wilson

    Sound fade out syntax?

    onefiftymph Level 1

      Re-learning Dir. after many years away and updating old files, I find things don't work in Dir. 11.

       

      In the old days, this used to be in the Lingo library and was a common score script:

       

      on exitFrame

        sound fadeOUT, 5 * 60

      end

       

       

      This causes a script error now. What do I need to use instead?

       

      thanks

        • 1. Re: Sound fade out syntax?
          Sean_Wilson Adobe Community Professional

          Check the docs. You need to provide a sound channel object and the milliseconds you want to fade over. So, assuming your sound is playing in channel 1, it might be

          on exitFrame me
            -- your 5 * 60 looks like a 'ticks' value
            -- in which case it's 5 seconds or 5000 ms
            sound(1).fadeOut(5000)
          end
          
          • 2. Re: Sound fade out syntax?
            onefiftymph Level 1

            Thanks so much Sean. Since that seemed to be so easy...;0)..... here's my next old script that doesn't work:

             

            on mouseDown

              set the membernum of sprite 34 to 6

              puppetsound "snap1"

              updatestage

              repeat while the mousedown

                nothing

              end repeat

            end


            on mouseUp

              puppetsound "snap8"

              set the membernum of sprite 34 to 5

              updatestage

              if rollover(34) then

                go next

              end if

            end

             

            This used to work well for what I'm doing.... I tried making it on mouseDown me and on mouseUp me, but that didn't do it...

             

            Would appreciate some pointers... thanks.

            • 3. Re: Sound fade out syntax?
              Sean_Wilson Adobe Community Professional

              Try:

              on mouseDown me
                sprite(34).member = member(6, 1)
                sound(1).play( member("snap1") )
                _movie.updateStage()
                repeat while _mouse.mouseDown
                  nothing
                end repeat
              end
              
              on mouseUp me
                sprite(34).member = member(5, 1)
                sound(1).play( member("snap8") )
                _movie.updateStage()
                if _movie.rollover(34) then
                  go next
                end if
              end
              

               

              Note: it's better to name members and then refer to them by name instead of number ( for example: member(6, 1) ) because if they are named you can move them anywhere in the castLib without breaking your code, but if they are referred to by number they have to stay where they are.

              1 person found this helpful
              • 4. Re: Sound fade out syntax?
                onefiftymph Level 1

                hmmm....doesn't seem to work any better....just doesn't wanna "go next"... ornery i s'pose...

                • 5. Re: Sound fade out syntax?
                  Sean_Wilson Adobe Community Professional

                  Sorry - I didn't understand that it was the go() command that was giving you problems. Time for some debugging - refer to your message window for output:

                  on mouseDown me
                    sprite(34).member = member(6, 1)
                    sound(1).play( member("snap1") )
                    _movie.updateStage()
                    repeat while _mouse.mouseDown
                      nothing
                    end repeat
                  end

                  on mouseUp me
                    sprite(34).member = member(5, 1)
                    sound(1).play( member("snap8") )
                    _movie.updateStage()
                    put "rollOver:", _movie.rollOver()
                    if _movie.rollover(34) then
                      put "frame before:", the frame
                      _movie.goNext()
                      put "frame after:", the frame
                    end if
                  end