サウンドを再生して画像を読み込もうとしている Flash (ActionScript 3) プロジェクトを作成しました。
IDE として FlashDevelop を使用しています。
サウンドは再生されませんが、エラーもスローされません。画像も正常に読み込まれます
ファイル:
-bin
-js
-swfobject.js
-expressInstall.swf
-index.html
-MyApp.swf
-images
-horse.png
-lib
-sounds
-coin.wav
-src
-main.as
-Main.swf
そして私のmain.as
:
package
{
import flash.display.Sprite;
import flash.events.Event;
import flash.display.Loader;
import flash.net.URLRequest;
import flash.media.Sound;
public class Main extends Sprite
{
public function Main():void
{
if (stage) init();
else addEventListener(Event.ADDED_TO_STAGE, init);
}
private function init(e:Event = null):void
{
removeEventListener(Event.ADDED_TO_STAGE, init);
addImages();
addSound();
}
private function addImages():void {
var imageLoader:Loader = new Loader();
imageLoader.load(new URLRequest("../images/horse.png"));
imageLoader.x = 100;
imageLoader.y = 100;
addChild(imageLoader);
}
private function addSound():void {
var mySound:Sound = new Sound();
mySound.load(new URLRequest("../sounds/coin.wav"));
mySound.play();
}
}
}
サウンドのロードが間違っていますか? 大丈夫.wav
ですか?