2010-10-27 26 views
0

我試圖使用Netstream類 - 標準東西播放FLV,確實使用的任何東西都不比在幫助中可以找到的東西複雜文件。我已經創建了一個控制面板,您可以使用該控制面板單擊並拖動並拖動視頻。AS3 - 在FLV完成加載後無法使用netstream.seek()掃描FLV

導出到Flash Player 9,它工作正常,我可以擦洗視頻,但只有在FLV仍在加載時。一旦達到100%,清理(使用Netstream.seek())變得非常無法響應,幾乎達到讓玩家崩潰的程度。

我已經殺死了所有的ENTER_FRAMES,刪除了所有不必要的偵聽器,並且使我能想到的所有東西都無效,但是一旦負載結束,大量資源密集的東西似乎就在踢。

有沒有人見過這個?我從來沒有遇到過這個問題,在各種論壇上找不到類似的東西。

下面的代碼,但我不認爲鼠標移動拖動操作是問題!罰款在Flash CS4 IDE,在瀏覽器中損壞。

感謝您也許能提供任何幫助,

加雷思

// Drag 
    private function dragVideo(e:MouseEvent):void { 

     // Match the x position of the dragger to the x position of the mouse 
     videoControls.progressBar.dragger.x = videoControls.progressBar.barInner.mouseX; 

     // If this results in the dragger moving outside the dragging area, constrain it 
     if (videoControls.progressBar.dragger.x < videoProgressRectangle.left) { 
      videoControls.progressBar.dragger.x = videoProgressRectangle.left; 
     } else if (videoControls.progressBar.dragger.x > videoProgressRectangle.right) { 
      videoControls.progressBar.dragger.x = videoProgressRectangle.right; 
     } 

     // As the dragger moves, work out its position as a percentage of the total distance it CAN move 
     // That distance is the width of the black inner bar but you must also accomodate the centred registration point of the dragger 
     // So knock off half the dragger's width from it's current position (which gives the left edge of the inner bar) 
     // Then knock off the dragger's width minus the 2px overhang of the white progress bar border, from the total draggable distance 
     videoSeekPercentageMouse = (videoControls.progressBar.dragger.x - (videoControls.progressBar.dragger.width/2))/(videoControls.progressBar.barInner.width - (videoControls.progressBar.dragger.width - 2)); 

     // Now use that percentage to seek the video to the equivalent percentage of its total time 
     if (videoSeekPercentageMouse <= 0) { 
      videoNetStream.seek(0); 
     } else if (videoSeekPercentageMouse >= 1) { 
      // Because video metaData says the length is xyz while the real length is xyz + 0.015, 
      // seek to slightly before the end 
      videoNetStream.seek(videoDuration - 0.016); 
     } else { 
      videoNetStream.seek(videoDuration * videoSeekPercentageMouse); 
     } 

     // Show the video's current progress 
     videoControls.progressBar.barProgress.scaleX = videoSeekPercentageMouse; 

     // After the mouse moves update the display 
     e.updateAfterEvent(); 

    } 
+0

你接受了什麼NetStatusEvents,你如何繪製加載進度條? – www0z0k 2010-10-28 04:36:22

+0

Hello - 進度條是在Flash CS4 IDE的舞臺上繪製的動畫片段。沒關係,我想。 NetStatusEvents一開始就很好,給出如下內容:NetConnection.Connect.Success,NetStream.Play.Start,NetStream.Buffer.Full,NetStream.Buffer.Empty,NetStream.Seek.Notify按預期。然後,似乎發生的是,FLV完成下載,我得到多個NetStream.Buffer.Flush響應。沖洗之後,FLV不能​​可靠地尋找更多。任何想法,如果我做錯了?這是一個漸進式下載而不是流 - 我是否應該使用除NetStream以外的其他內容? – 2010-10-28 09:56:32

+0

詛咒 - 每次都無法獲得這些buffer.flush響應。但一旦FLV完成下載尋求停止工作順利。 – 2010-10-28 10:27:33

回答

1

明白了!

你應該尋求 「之前」 試試這個..

暫停流.. SEEK() 然後恢復流!