2011-02-04 11 views
0

私が取り組んでいるウェブサイト用のオーディオプレーヤーを設定しようとしていますが、このエラー2032を実行し続けます。 .swfは私の曲リストファイルとともに私のメインフォルダにあります。曲ファイル自体は、songs/Flash mp3プレーヤーでエラー2032がスローされる - 考えているURLRequestが原因ですか?

という名前のサブフォルダにあります。何が原因で起こりうるのか分かりません。

<fx:Script> 
    <![CDATA[ 
     import mx.collections.ArrayCollection; 
     import mx.collections.ArrayList; 
     import mx.collections.XMLListCollection; 
     import mx.controls.Alert; 
     import mx.rpc.events.FaultEvent; 
     import mx.rpc.events.ResultEvent; 
     import mx.utils.ArrayUtil; 
     private var sound:Sound;      // Mp3 File 
     private var soundChannel:SoundChannel;   // Reference to playing channel 
     private var pausePosition:Number;    // Current play position (time) 
     private var percent:Number;      // Current played percentage 
     private var isPlaying:Boolean = false;   // Is the mp3 playing? 
     private var isLoaded:Boolean = false;   // Is the mp3 loaded? 
     //private var updateSeek:Timer = new Timer(500); // Timer for updating the seek bar 
     private var currentSong:String; 
     private var index:int; 
     private var start:Boolean = true; 
     private var songs:Array; 

     private function init():void { 
      grabSongs(); 
     } 

     private function grabSongs():void{ 
      var theLoader:URLLoader = new URLLoader(); 
      var theRequest:URLRequest = new URLRequest("songlist.txt"); 
      theLoader.load(theRequest); 
      theLoader.addEventListener(Event.COMPLETE, loadComplete); 
     } 
             

     private function loadComplete(theEvent:Event):void{ 
      songs = theEvent.target.data.split("\n"); 
      currentSong = songs[0]; 
      index = 0; 
     } 

     private function playPause(e:Event = null):void { 
      // Song playing? 
      if(isPlaying) { 
       // Save the current position in the track, stop playback, change button icon 
       pausePosition = soundChannel.position; 
       soundChannel.stop(); 
       this.btnPlay.label = "Play"; 
       // If the URL has been changed but not loaded, hide seekbar 
       // Song is not playing? 
      } else { 
       if(!isLoaded) { 
        // If the song isn't loaded yet, set up a new sound load request 
        if(start == true){ 
         start = false; 
        } 
        sound = new Sound(); 
        sound.load(new URLRequest("songs/" + currentSong)); 
        // Add an event listener to check for song load complete event 
        sound.addEventListener(Event.COMPLETE, songLoaded); 
        this.btnPlay.label ="Pause"; 
       } else { 
        // The song IS loaded, so play it 
        soundChannel = sound.play(pausePosition); 
        this.btnPlay.label = "Pause"; 
       } 
      } 
      // Regardless of playing state, change it now to the opposite 
      isPlaying = !isPlaying; 
     } 

     private function songLoaded(e:Event):void { 
      // Remove load event listener 
      sound.removeEventListener(Event.COMPLETE, songLoaded); 

      // Play the song 
      soundChannel = sound.play(0);    
      // Song is loaded 
      isLoaded = true; 
     } 

     private function prev(e:Event = null):void { 
      if(start == false){ 
       if(index == 0){ 
        index = songs.length - 1; 
       }else{ 
        index--; 
       } 
       currentSong = songs[index]; 
       isPlaying = true; 
       isLoaded = false; 
       playNew(e); 
      } 
     } 


     private function next(e:Event = null):void { 
      if(start == false){ 
       if(index == songs.length - 1){ 
        index = 0; 
       }else{ 
        index++; 
       } 
       currentSong = songs[index]; 
       isPlaying = true; 
       isLoaded = false; 
       playNew(e); 
      } 
     } 

     private function playNew(e:Event = null):void { 
      soundChannel.stop(); 
      sound = new Sound(); 
      sound.load(new URLRequest("songs/" + currentSong)); 
      // Add an event listener to check for song load complete event 
      sound.addEventListener(Event.COMPLETE, songLoaded); 
      this.btnPlay.label = "Pause"; 
     } 

    ]]> 
</fx:Script> 

<s:Button id="btnPrev" label="Previous" chromeColor="#000000" focusColor="#000000" color="#8D1111" enabled="true" click="{prev(event)}" height="20" width="80" x="0" y="0"/> 
<s:Button id="btnPlay" label="Play" chromeColor="#000000" focusColor="#000000" color="#8D1111" enabled="true" click="{playPause(event)}" height="20" width="80" x="81" y="0"/> 
<s:Button id="btnNext" label="Next" chromeColor="#000000" focusColor="#000000" color="#8D1111" enabled="true" click="{next(event)}" height="20" width="80" x="162" y="0"/> 

これは私のラップトップ上でローカルに動作しますが、私はswfファイルをアップロードするとき、それはエラーにスロー2032

おかげ

更新

ので、セットアップがFlexFiend私はフラッシュデバッガのログファイルをチェックしてみました、これは私のメッセージだったhttp://localhost/FlexStuff/songs/と一緒に、答えとまったく同じです:

エラー#2032:ストリームエラー。 URL:http://www.mywebsite.com/framework_4.0.0.14159.swf

私はこれが何を意味するのかよくわかっていませんが、おそらく私の問題を引き起こしていますか?

+0

あなたは 'songlist.txt'(と他のもの)はすべて同じフォルダにありますか?ローカルマシンで?どの行で 'error 2032:stream error'が発生し、いつですか? – www0z0k

+0

こんにちはニック、ようこそ。あなたの質問を編集して明確にすることができます。回答フィールドは回答のみに使用してください。私はあなたの質問の一番下に回答として書いたものをマージしました。 –

答えて

0

「songlist.txt」のパスがローカルサーバー上にあることを確認します。リモートサーバー上にある場合は、ドメイン間の問題を調査する必要があります。しかし、そうであれば、それを読むことを試みることさえできませんでしたが、代わりに私が仮定するポリシー違反をあなたに知らせます。

"songlist.txt"ファイルは、サーバー上でアクセスしているswfと同じディレクトリにある必要があります。

エラー#2032:すなわち

http://localhost/FlexStuff/Swfalicious.html (the wrapper) 
http://localhost/FlexStuff/songlist.txt 
http://localhost/FlexStuff/Swfalicious.swf (the actual swf file) 
0

ので、セットアップはFlexFiend が http://localhost/FlexStuff/songs/と一緒に、私は、ログ フラッシュデバッガのファイルと、この が私のメッセージだったをチェックしてみました、答えとまったく同じですストリームエラー。 URL: http://www.mywebsite.com/framework_4.0.0.14159.swf

私は何この 手段を備えた非常に不慣れですが、多分その私の 問題を引き起こして?

「framework_4.0.0.14159.swfは、」私は明らかにも...私が必要だったとは思いませんでした動作するように、このSWFファイルを取得するために自分のサーバーにアップロードしていた約6 SWFファイルの一つでした?? アップロードされても機能します。これは私が作成したswfをアップロードしなければならないという印象を受けて以来、本当に奇妙です。

関連する問題