我正在使用Flash Builder 4.6(为了维护设计功能,因为已删除 - 我也有4.7 - 两者都注册了)我对这个IDE和语言很新,所以如果我的代码看起来很糟糕,请原谅我,只是玩基础知识,我不能为我的生活从我的硬盘驱动器获取声音文件,我可以链接HTTP文件,只是不本地,我猜我不确定正确的格式。 (请参阅下面的工作区图像,包括文件结构)
<i><?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark" title="SoundPadX - Home">
<fx:Script>
<![CDATA[
protected function button1_clickHandler(event:MouseEvent):void
{
**var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("library://libs/Bullet_Impact_Glass_Window.mp3")
var so = new Sound(req,context)
so.play()
}**
protected function button2_clickHandler(event:MouseEvent):void
{
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/4678e9e915ed305c704bb208e1ded2ce.mp3")
var so = new Sound(req,context)
so.play()
}
}
protected function button3_clickHandler(event:MouseEvent):void
{
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/c569fb12aed286d9a36293ff530e10cc.mp3")
var so = new Sound(req,context)
so.play()
}
}
protected function button4_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/df24dcd8fa4cf7f72f5acd6a314046ad.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button5_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/0a36573fc5f0a3ac6bb1eb077e1c7078.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button6_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/68df86b9f02af0324eb78badaf1db1c7.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button7_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/3c215f5294db2b37f3f15b8b35e149c0.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button8_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/ac21feb2c77136f55e97ebe22fbee7c6.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button9_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/d82d65da7ea01bdb20a3b0f6947bc106.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button10_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/e22ddf144057542f44b3127a414cd8e7.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button11_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/66fd3298f0042f5dbd81c0c163053fe9.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button12_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/865d2d5893fa10e2488d5dc83ed3386a.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button13_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/372ab5d12e4f71b580885ed96dcdd635.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button14_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/1ac11fb2e883dea0098acee177c7bc56.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button15_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/5a93cb85ec7ff1e1d80f6b1379da3a87.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button16_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/85838136dd6ca3f6b311b9d1cf2a7dad.mp3")
var so = new Sound(req,context)
so.play()
}
protected function button17_clickHandler(event:MouseEvent):void
{
var req:URLRequest;
var context:SoundLoaderContext = new SoundLoaderContext(8000)
var s:Sound;
req = new URLRequest("http://picosong.com/cdn/84b00df302a73f9a4b93a8fda5ba5790.mp3")
var so = new Sound(req,context)
so.play()
}
]]>
</fx:Script>
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>
<s:Button left="10" top="13" width="73" height="29" label="Thunder 1"
click="button1_clickHandler(event)" fontSize="9"/>
<s:Button x="10" y="47" width="73" height="27" label="Rain + Wind"
click="button2_clickHandler(event)" fontSize="9"/>
<s:Button x="10" y="80" width="73" height="26" label="Exploson 1"
click="button6_clickHandler(event)" fontSize="9"/>
<s:Button x="10" y="110" height="27" label="Explosion 2" fontSize="9"/>
<s:Button x="10" y="142" height="28" label="Explosion 3" click="button7_clickHandler(event)"
fontSize="9"/>
<s:Button x="10" y="178" width="72" height="24" label="Kaboom!"
click="button8_clickHandler(event)" fontSize="9"/>
<s:Button x="91" y="13" width="69" height="29" label="Thunder 2"
click="button3_clickHandler(event)" fontSize="9"/>
<s:Button x="91" y="47" width="69" height="27" label="AK47 1" click="button4_clickHandler(event)"
fontSize="9"/>
<s:Button x="90" y="82" width="73" height="24" label="AK47 2" click="button5_clickHandler(event)"
fontSize="9"/>
<s:Button x="91" y="114" width="72" height="23" label="Helicopter Pass"
click="button9_clickHandler(event)" fontSize="7"/>
<s:Button x="90" y="145" width="73" height="25" label="Missile!"
click="button10_clickHandler(event)" fontSize="9"/>
<s:Button x="91" y="178" width="72" height="24" label="Missile! 2"
click="button11_clickHandler(event)" fontSize="9"/>
<s:Button x="10" y="210" width="72" height="26" label="Rocket Away!"
click="button12_clickHandler(event)" fontSize="8"/>
<s:Button x="91" y="210" width="72" height="26" label="Rockslide"
click="button13_clickHandler(event)" fontSize="9"/>
<s:Button x="10" y="244" width="73" height="23" label="Freight Train"
click="button14_clickHandler(event)" fontSize="8.5"/>
<s:Button x="91" y="244" height="23" label="Water Mud" click="button15_clickHandler(event)"
fontSize="9"/>
<s:Button x="91" y="275" height="25" label="Windy Wet" click="button17_clickHandler(event)"
fontSize="9"/>
<s:Button x="11" y="275" width="71" height="25" label="Wet Splash"
click="button16_clickHandler(event)" fontSize="8.5"/>
</s:View>
此处的屏幕截图: