2011-01-13 3 views
0

私は少しのマッシュアップマップを作成し、apiとflickrを翻訳しました。私はマップからの道順を得て、同時にmp3ファイルを作って、同時にそれらを再生するが、彼らはFirefoxでしか再生せず、残りのブラウザでは私はバックグラウンドミュージックで初めてのサウンドチャンネルを取得する。理由を理解できません。どんな助けも高く評価されます。おそらくアクションスクリプトのサウンドチャンネルはFirefoxでしか再生されません

private var _sound:Sound; 
private var _sc:SoundChannel; 
private var _isPlaying:Boolean; 
private var _url:String; 
private var myWatcher:ChangeWatcher; 
private var isPlaying:Boolean; 

private function _generateSpeech():void { 

var txt:String = description.text; 
var url:String = "http://translate.google.com/translate_tts?tl=en&q=" + txt; 
_url = url; 
var req:URLRequest = new URLRequest(url); 

_sound = new Sound(); 
_sound.addEventListener(Event.OPEN, _soundOpenHandle, false, 0, true); 
_sound.addEventListener(ProgressEvent.PROGRESS, _soundProgHandle, false, 0, true); 
_sound.addEventListener(Event.COMPLETE, _soundLoadedHandle, false, 0, true); 
_sound.addEventListener(IOErrorEvent.IO_ERROR, _errorHandle, false, 0, true); 
_sound.load(req,null); 
} 
private function _soundOpenHandle(e:Event):void {isPlaying = false;} 
private function _soundProgHandle(e:ProgressEvent):void {isPlaying = true;} 
private function _soundLoadedHandle(e:Event):void {isPlaying = true;} 
private function _playbackCompleteHandle(e:Event):void {isPlaying = false;} 
private function _errorHandle(e:IOErrorEvent):void {trace(e);} 

private function _playSpeech():void { 
_generateSpeech(); 
_sc = new SoundChannel(); 
if (!isPlaying){_sc = _sound.play(0,0,null);} 
_sc.addEventListener(Event.SOUND_COMPLETE, _playbackCompleteHandle, false, 0, true); 
} 
public function initWatcher():void { 
ChangeWatcher.watch(description, "text", watcherListener); 
} 
// Event listener when binding occurs. 
public function watcherListener(event:Event):void { 
if (!isPlaying){_playSpeech(); } 
} 

答えて

0
_sc = new SoundChannel(); 
if (!isPlaying){_sc = _sound.play(0,0,null);} 
_sc.addEventListener(Event.SOUND_COMPLETE, _playbackCompleteHandle, false, 0, true); 

if (!isPlaying){ 
    _sc = _sound.play(0,0,null);} 

    if(_sc) { 
     _sc.addEventListener(Event.SOUND_COMPLETE, _playbackCompleteHandle, false, 0, true); 
    } 
} 
+0

いくつかの説明は? –

関連する問題