Skip navigation
Currently Being Moderated

How to play sound located in different folder in flex?

Feb 18, 2013 5:37 PM

Tags: #flex #4.6

I can access and play file named "Song.mp3" located in the root directory of my project but when I put it into "assets" directory I got error.

Here is my project directory:

- Test 
-- src
--- Homeview.mxml
-- assets
--- Song.mp3
-- Song.mp3

I can access and play Song.mp3 located in the root folder but I get error when I want to play assets/Song.mp3.

This works:

var req:URLRequest = new URLRequest('../Song.mp3');

This does not:

var req:URLRequest = new URLRequest('../assets/Song.mp3');

I get following Runtime error:

Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: app:/assets/Song.mp3

I think that Song.mp3 in the root directory get exported in the final swf file but assets/Song.mp3 does not. If that is the case is there a way to force Flex to export assets/Song.mp3?


More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points