如何在AIR应用程序中的as3中指向桌面目录上的文件

问题描述 投票:0回答:1

我当前正在使用它来从AIR桌面程序中桌面上的文件夹中成功加载(和播放)mp3:

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

效果很好,但是我不想使用显式路径。我想使用类似的东西:

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

...这当然不适合那里的编码方式,但是我该怎么做?

谢谢

actionscript-3 air
1个回答
0
投票

想通了:

soundBG2.load(new URLRequest(File.desktopDirectory.nativePath + "/music/mySong.mp3"));
© www.soinside.com 2019 - 2024. All rights reserved.