A Flash Developer Resource Site

Results 1 to 3 of 3

Thread: button with sound and animation

  1. #1
    Junior Member
    Join Date
    Feb 2004
    Posts
    2

    button with sound and animation

    how do I create a button that when pressed plays a looped beat and a synced animation, and when pressed again stops both the animation and the loop.

  2. #2
    Registered User
    Join Date
    Apr 2001
    Location
    Akron OH, USA
    Posts
    4,841
    Unfortunately, this is one thing that is not easy to accomplish in Flash.

    probably the simplest thing to do is start the sound looping and the animation at the same time, but this does not guarantee sync. Eventually the two will drift appart.

    a second option is to place the sound and animation on the root timeline set the sound to stream sync and duplicate the loop many times across the timeline, along with the animation. The advantage is that the sound and graphics will sync but you will have to rely upon streaming delivery for the sound, the sound and animation may stop playing intermitantly due to buffering if the user does not have enough bandwidth.

    a 3rd option is to restart the animation and sound at the end of the sound using onSoundComplete. In this case the start of both animation and sound are always in sync but the ends may not be because Flash may adjust the frame rate occasionaly to accomodate the CPU load.

    a 4th option is to repeatedly poll the position of the sound object as it plays and display graphics accordingly. This is counterintuitive to the way Flash handles animation and requires some committed ActionScript work on your part.

  3. #3
    Junior Member
    Join Date
    Feb 2004
    Posts
    2
    thanks for your help. i will have a go at the first two options

    take it easy....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center