Log in

No account? Create an account

MXML component for playing sound (MP3)

« previous entry | next entry »
May. 22nd, 2006 | 12:53 pm

If I had a dollar for every time somebody asked me why Flex 2.0 doesn't have an MP3 player component, er, .... So anyway, I wrote one last night.

<SoundPlayer source="boombastic.mp3" />

Source: SoundPlayer.as

Features (not directly available in Flash's Sound object):

  • Automatic load and play
  • Volume control
  • Pause
  • Seek1
  • Events for play, stop, sound progress, etc.
  • Data-bindable properties

This is also intended as an example of how to write your own "faceless" (non-visual) MXML components.

The code is available under the MIT license. Enjoy.

1: Assigning a new value to the position property performs a seek operation.

Tags: ,