2008-09-16 1 views
1

xml 파일을 통해로드 된 노래 세트가있는 플래시 플레이어가 있습니다.스트리밍 모드에서 플래시로 mp3 파일을 다운로드하는 것을 중지하는 방법

파일을 선택하기 전에 파일의 스트림이 시작되지 않습니다.

8 개의 파일 각각을 빠르게 순환하면 동시에 8 개의 파일 각각을 다운로드하려고합니다.

다운로드중인 파일을 지우는 방법이 있는지 궁금합니다. 따라서 누군가가 많은 트랙 이름을 클릭하기로 결정하면 대역폭이 줄어들지 않습니다. mySound.clear 같은

뭔가 .. 좋은, 또는 mySound.stopStreaming 것

누군가가 전에이 문제가 있었나요

?

감사합니다,

크리스

+0

이 액션 스크립트는 2 또는 3입니까? – grapefrukt

답변

1

체크 아웃 Sound.Close()을 확인하십시오. 워드 프로세서

". 는 데이터의 다운로드를 중지 스트림 (Stream)을 닫아, 없음 데이터가 close() 메서드를 호출 한 후에는 스트림에서 읽을 수 있습니다."

이는 source code example에서입니다 연결된 문서 :

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; 
     } 
    } 
} 
0

당신이 경우에 뭔가 같은 :

MySoundObject = 정의되지 않은;

그렇게해야합니다.