2
即时通讯新本。只是制作了一个两页的音板。它的工作很棒。问题是我想要将声音保存为铃声/通知。没有例子说明如何在as3中做到这一点。请帮助!AIR应用程序AS3:保存声音作为铃声/通知
即时通讯新本。只是制作了一个两页的音板。它的工作很棒。问题是我想要将声音保存为铃声/通知。没有例子说明如何在as3中做到这一点。请帮助!AIR应用程序AS3:保存声音作为铃声/通知
使用编码为MP3格式:https://github.com/kikko/Shine-MP3-Encoder-on-AS3-Alchemy
将MP3数据文件作为这样的:
private function saveFile()
{
// WRITE ID3 TAGS
var sba:ByteArray = mp3Encoder.mp3Data;
sba.position = sba.length - 128
sba.writeMultiByte("TAG", "iso-8859-1");
sba.writeMultiByte("Microphone Test 1-2, 1-2 "+String.fromCharCode(0), "iso-8859-1"); // Title
sba.writeMultiByte("jordansthings "+String.fromCharCode(0), "iso-8859-1"); // Artist
sba.writeMultiByte("Jordans Thingz Bop Volume 1 "+String.fromCharCode(0), "iso-8859-1"); // Album
sba.writeMultiByte("2010" + String.fromCharCode(0), "iso-8859-1"); // Year
sba.writeMultiByte("www.jordansthings.com " + String.fromCharCode(0), "iso-8859-1");// comments
sba.writeByte(57);
filePath = (File.applicationStorageDirectory.resolvePath("sound3.mp3")).url;
// get the native path
var wr:File = new File(filePath);
// create filestream
var stream:FileStream = new FileStream();
// open/create the file, set the filemode to write in order to save.
stream.open(wr , FileMode.WRITE);
// write your byteArray into the file.
stream.writeBytes (sba, 0, sba.length);
// close the file.
stream.close();
}
嘿 - 我怀疑没有人试图提供帮助,因为你提供的信息非常少。铃声(通知?)没有标准文件类型,您必须选择一个或两个才能定义问题。将文件保存为MP3是一件相当先进的事情,保存到WAV稍微少一点。你将不得不对ByteArray和FileReference类进行一些研究。有人可能会认为你正在将MP3中的声音加载到你的应用程序中,所以你可能比你想象的更接近。 – NHubben 2011-07-30 23:36:56