Shaun
Shaun

Reputation: 2181

How to point to a file on a desktop directory in as3 in an AIR app

I'm currently using this to successfully load (and play) an mp3 from a folder on my desktop in my AIR desktop program:

soundBG2.load(new URLRequest("C:/Users/User/Desktop/music/mySong.mp3"));

It works well, however I'd like to not use an explicit path. I'd like to use something like:

soundBG2.load(new URLRequest(desktopDirectory+"/music/mySong.mp3")); 

...which of course doesn't work the way it's coded there, but how to I do that please?

Thank you

Upvotes: 1

Views: 72

Answers (1)

Shaun
Shaun

Reputation: 2181

Figured it out:

soundBG2.load(new URLRequest(File.desktopDirectory.nativePath + "/music/mySong.mp3"));

Upvotes: 3

Related Questions