停止方法については、mp3ファイルからダウンロードによるflashがストリーミングモード

StackOverflow https://stackoverflow.com/questions/75052

  •  09-06-2019
  •  | 
  •  

質問

私にはflashプレイヤーセットの歌を読みxmlファイルとなります。

ファイルをゴタストリームまで送迎します。

場合を早くしてサイクルを通じてそれぞれの8ファイル、flashを開始しようと各ソフトウェアのダウンロードは8つのファイルも同時に行います。

った場合はをクリアファイルのファイルがダウンロードできます。その帯域では食べられなかが誰かを決定をクリックのトラック名です。

のようなものmySound.明確にすると、mySound.stopStreaming..

ですがこの問題。

について

クリス

役に立ちましたか?

解決

チェック 音が出ます。Close().

からのドキュメント:"ストリームを閉じ、他のデータのダウンロードに居なくなってしまっています。なデータから読み取られるストリームのclose()メソッドが呼び出されます。"

この ソースコードの例 からのリンク先のdocs:

package {
    import flash.display.Sprite;
    import flash.net.URLRequest;
    import flash.media.Sound;    
    import flash.text.TextField;
    import flash.text.TextFieldAutoSize;
    import flash.events.MouseEvent;
    import flash.errors.IOError;
    import flash.events.IOErrorEvent;

    public class Sound_closeExample extends Sprite {
        private var snd:Sound = new Sound();
        private var button:TextField = new TextField();
        private var req:URLRequest = new URLRequest("http://av.adobe.com/podcast/csbu_dev_podcast_epi_2.mp3");

        public function Sound_closeExample() {
            button.x = 10;
            button.y = 10;
            button.text = "START";
            button.border = true;
            button.background = true;
            button.selectable = false;
            button.autoSize = TextFieldAutoSize.LEFT;

            button.addEventListener(MouseEvent.CLICK, clickHandler);

            this.addChild(button);
        }

        private function clickHandler(e:MouseEvent):void {

            if(button.text == "START") {

                snd.load(req);
                snd.play();        

                snd.addEventListener(IOErrorEvent.IO_ERROR, errorHandler);

                button.text = "STOP";
            }
            else if(button.text == "STOP") {

                try {
                    snd.close();
                    button.text = "Wait for loaded stream to finish.";
                }
                catch (error:IOError) {
                    button.text = "Couldn't close stream " + error.message;    
                }
            }
        }

        private function errorHandler(event:IOErrorEvent):void {
                button.text = "Couldn't load the file " + event.text;
        }
    }
}

他のヒント

う場合のようなもの:

MySoundObject=未定義;

るべきます。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top