2 Replies Latest reply on Nov 2, 2007 7:37 PM by clbeech

    Actionscript button problems

      I'm doing a flash based web site for school and need help with buttons i am making. They are "piano" keys in which i need them to play a sound when i press the button down, but the sound should stop when i release the button. Please I really need the help!!

        • 1. Re: Actionscript button problems
          jmoggio Level 1

          • 2. Re: Actionscript button problems
            clbeech Level 3
            create your sounds using AS Sound Objects, then target the Sound Object using code. With a sound (preferably mp3) in the Library, and a Linkage identifier specific to the sound, on the timeline of the 'key' MC wirte the following:

            PS. in this example I have used the Linkage id of 'note_C', and a SoundObject instance name of 'key_C'. you will want to elaborate on the references to different octives. Also the two parameters in the Sound.start() method, are 1)the offset seconds, and 2) the amount of loops the instance will play. Assuming that you will want to keep the file size as small as possible, you will only need a sound bite of a second or two, and then it will loop continuously (well 999 times here but you can set it higher) then it will stop when the button is released.