• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
Locked
0

How to play sound located in different folder in flex?

New Here ,
Feb 18, 2013 Feb 18, 2013

Copy link to clipboard

Copied

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?

Views

587

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 01, 2013 Mar 01, 2013

Copy link to clipboard

Copied

LATEST

I found the reason of this error. The problem was not access restriction but it was rather because files and folders outside src directory does NOT get exported into the final package thus makes them UNAVAILABLE rather that restricted.

The solution is to simply put assets inside src folder.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines