2010-10-27 97 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() 然后恢复流!