O'Reilly logo

Flash Development for Android Cookbook by Joseph Labrecque

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Playing audio files from the local filesystem or over HTTP

The playback of audio files through Flash Platform runtimes on Android devices is fairly straightforward. We can point to files bundled with our application, as this recipe demonstrates, files on the device storage, or files over a remote network connection. No matter where the file is located, playback is accomplished in the same way.

How to do it…

We must load the audio file into a Sound object and will then have the ability to manipulate playback, volume, pan, among other properties. In this recipe, we will allow the user to control volume through the rotation of a basic dial:

  1. First, import the following classes into your project:
    import flash.display.Sprite; import flash.display.StageAlign; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required