<?xml version="1.0" encoding="UTF-8"?><!-- generator="wordpress/2.0.2" -->
<rss version="2.0" 
	xmlns:content="http://purl.org/rss/1.0/modules/content/">
<channel>
	<title>Comments on: How to Build an Interactive Flash Video (FLV) Load Progress Bar</title>
	<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar</link>
	<description>Luck is the residue of good design.</description>
	<pubDate>Wed, 19 Nov 2008 04:21:38 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.0.2</generator>

	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-169416</link>
		<pubDate>Thu, 24 Apr 2008 20:11:23 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-169416</guid>
					<description>&lt;strong&gt;To HeavyPops ...&lt;/strong&gt;

Looks like WordPress gobbled your code!  Give it another shot.

&lt;strong&gt;To David ...&lt;/strong&gt;

When readers do run across the trouble you've described, it's usually because of a missing object reference.  Sometimes people declare their &lt;code&gt;idTracking&lt;/code&gt; variable out of scope, so that it doesn't clear with &lt;code&gt;clearInterval()&lt;/code&gt;, which means the &lt;code&gt;updateKnob()&lt;/code&gt; function executes more twice and sometimes thrice over &amp;#8212; and the loop continues even while they're dragging.

Put &lt;code&gt;trace(&amp;#34;updateKnob&amp;#34;);&lt;/code&gt; somewhere inside your version of the &lt;code&gt;updateKnob()&lt;/code&gt; function, then test again.  That will let you see immediately if the function continues to trigger while you attempt to drag the knob.</description>
		<content:encoded><![CDATA[<p><strong>To HeavyPops &#8230;</strong></p>
<p>Looks like WordPress gobbled your code!  Give it another shot.</p>
<p><strong>To David &#8230;</strong></p>
<p>When readers do run across the trouble you&#8217;ve described, it&#8217;s usually because of a missing object reference.  Sometimes people declare their <code>idTracking</code> variable out of scope, so that it doesn&#8217;t clear with <code>clearInterval()</code>, which means the <code>updateKnob()</code> function executes more twice and sometimes thrice over &mdash; and the loop continues even while they&#8217;re dragging.</p>
<p>Put <code>trace(&quot;updateKnob&quot;);</code> somewhere inside your version of the <code>updateKnob()</code> function, then test again.  That will let you see immediately if the function continues to trigger while you attempt to drag the knob.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-165568</link>
		<pubDate>Fri, 18 Apr 2008 18:59:37 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-165568</guid>
					<description>Hi David,

     I'm working on a flv player myself and was just curious if you've had anyone reply that has had trouble with the 'knob' actually updating its 'x' position based on the mouse onPress in real time so the user can watch the knob travel along the scrub bar?  I've followed your tutorial very closely and this is the only piece of functionality I'm currently lacking.  If you have a moment, please respond.  Thank you so much for the tutorial and your help.</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>     I&#8217;m working on a flv player myself and was just curious if you&#8217;ve had anyone reply that has had trouble with the &#8216;knob&#8217; actually updating its &#8216;x&#8217; position based on the mouse onPress in real time so the user can watch the knob travel along the scrub bar?  I&#8217;ve followed your tutorial very closely and this is the only piece of functionality I&#8217;m currently lacking.  If you have a moment, please respond.  Thank you so much for the tutorial and your help.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: HeavyPops</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-124581</link>
		<pubDate>Sat, 26 Jan 2008 23:22:49 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-124581</guid>
					<description>Does anyone know how to apply a script for a total video time?

This is the one that I have:

ns.onMetaData = function(metadata)
{
    timerDuration = metadata.duration;
    var dur_seconds:Number = timerDuration;
    var minutes_dspl = Math.floor(dur_seconds/60);
    var seconds_dspl = Math.floor(dur_seconds%60);
    if (minutes_dspl</description>
		<content:encoded><![CDATA[<p>Does anyone know how to apply a script for a total video time?</p>
<p>This is the one that I have:</p>
<p>ns.onMetaData = function(metadata)<br />
{<br />
    timerDuration = metadata.duration;<br />
    var dur_seconds:Number = timerDuration;<br />
    var minutes_dspl = Math.floor(dur_seconds/60);<br />
    var seconds_dspl = Math.floor(dur_seconds%60);<br />
    if (minutes_dspl
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-110915</link>
		<pubDate>Tue, 11 Dec 2007 19:53:25 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-110915</guid>
					<description>Neal,

That's a good question.  ;)  The &lt;code&gt;NetStream&lt;/code&gt; class provides two buffer related properties, &lt;code&gt;bufferLength&lt;/code&gt; and &lt;code&gt;bufferTime&lt;/code&gt;.  In a sense, those are the buffer versions of &lt;code&gt;bytesLoaded&lt;/code&gt; and &lt;code&gt;bytesTotal&lt;/code&gt;, respectively.  It might get a bit tricky to combine bufferTime with the total time of the video ... you could grab the total seconds (i.e. duration) out of the metadata and compare that against the &lt;code&gt;bytesTotal&lt;/code&gt; property to determine an approximate duration-to-filesize ratio (this will change per FLV, of course, depending on its compression, bitrate, and the like).  Subtract your &lt;code&gt;bufferTime&lt;/code&gt; from that, maybe, so you can track buffer first, then switch over to &lt;code&gt;bytesLoaded&lt;/code&gt; (perhaps minus &lt;code&gt;bufferTime&lt;/code&gt;) when &lt;code&gt;bufferLength&lt;/code&gt; has reached the value of &lt;code&gt;bufferTime&lt;/code&gt;.

Sounds like a fun challenge, actually!  But gosh, I haven't thought it through in detail at all yet.  This one isn't something I can just spout off the top of my head.</description>
		<content:encoded><![CDATA[<p>Neal,</p>
<p>That&#8217;s a good question.  <img src='http://www.quip.net/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />   The <code>NetStream</code> class provides two buffer related properties, <code>bufferLength</code> and <code>bufferTime</code>.  In a sense, those are the buffer versions of <code>bytesLoaded</code> and <code>bytesTotal</code>, respectively.  It might get a bit tricky to combine bufferTime with the total time of the video &#8230; you could grab the total seconds (i.e. duration) out of the metadata and compare that against the <code>bytesTotal</code> property to determine an approximate duration-to-filesize ratio (this will change per FLV, of course, depending on its compression, bitrate, and the like).  Subtract your <code>bufferTime</code> from that, maybe, so you can track buffer first, then switch over to <code>bytesLoaded</code> (perhaps minus <code>bufferTime</code>) when <code>bufferLength</code> has reached the value of <code>bufferTime</code>.</p>
<p>Sounds like a fun challenge, actually!  But gosh, I haven&#8217;t thought it through in detail at all yet.  This one isn&#8217;t something I can just spout off the top of my head.
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Neal</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-107208</link>
		<pubDate>Thu, 29 Nov 2007 16:37:31 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-107208</guid>
					<description>Hi David, hope you are well. I've just implemented the code you provided to Daniel above and it works great.

One more question if you don't mind. I've set my player to buffer the first ten seconds of video with &quot;ns.setBufferTime(10);&quot; and I've noticed that when doing this the loadbar doesn't display the scaling animation until the video starts to play (when its buffered 10secs of content). 

Is there a way to buffer the video for say 10secs but have the loadbar scaling begin immediately instead?

Thanks

Neal</description>
		<content:encoded><![CDATA[<p>Hi David, hope you are well. I&#8217;ve just implemented the code you provided to Daniel above and it works great.</p>
<p>One more question if you don&#8217;t mind. I&#8217;ve set my player to buffer the first ten seconds of video with &#8220;ns.setBufferTime(10);&#8221; and I&#8217;ve noticed that when doing this the loadbar doesn&#8217;t display the scaling animation until the video starts to play (when its buffered 10secs of content). </p>
<p>Is there a way to buffer the video for say 10secs but have the loadbar scaling begin immediately instead?</p>
<p>Thanks</p>
<p>Neal
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Daniel</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-94086</link>
		<pubDate>Fri, 26 Oct 2007 08:59:31 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-94086</guid>
					<description>Thanks David...

Daniel</description>
		<content:encoded><![CDATA[<p>Thanks David&#8230;</p>
<p>Daniel
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: David Stiller</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93835</link>
		<pubDate>Thu, 25 Oct 2007 18:24:05 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93835</guid>
					<description>Daniel,

You could create a new bar yet again &amp;#8212; either by drawing another or reusing (and tinting) the existing loader bar &amp;#8212; and set its &lt;code&gt;MovieClip._width&lt;/code&gt; property based on the location of the knob.  In fact, the &lt;code&gt;updateKnob()&lt;/code&gt; could handle this addition along with its existing tasks:

&lt;pre&gt;&lt;code&gt;function updateKnob():Void {
  knob._x = track._x + ns.time * ratio;
  newBarMC._width = knob._x - track._x;
}&lt;/code&gt;&lt;/pre&gt;

... That would assume that the new bar's position is also on the left edge shared by the other bars.  As the knob moves to, say, 50 pixels toward the right, its position is subtracted from &lt;code&gt;track&lt;/code&gt;'s &amp;#8212; the difference would be 50 &amp;#8212; and the new bar's width would become 50 to match.

You would have to update your knob dragging code as well:

&lt;pre&gt;&lt;code&gt;knob.onPress = function():Void {
  clearInterval(idTracking);
  ns.pause(true);
  this.onMouseMove = function():Void {
    if (track._xmouse &gt; 0 &amp;&amp; track._xmouse &lt; loader._width) {
      this._x = track._x + track._xmouse;
      newBarMC._width = knob._x - track._x;
    }
  }
}&lt;/code&gt;&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Daniel,</p>
<p>You could create a new bar yet again &mdash; either by drawing another or reusing (and tinting) the existing loader bar &mdash; and set its <code>MovieClip._width</code> property based on the location of the knob.  In fact, the <code>updateKnob()</code> could handle this addition along with its existing tasks:</p>
<pre><code>function updateKnob():Void {
  knob._x = track._x + ns.time * ratio;
  newBarMC._width = knob._x - track._x;
}</code></pre>
<p>&#8230; That would assume that the new bar&#8217;s position is also on the left edge shared by the other bars.  As the knob moves to, say, 50 pixels toward the right, its position is subtracted from <code>track</code>&#8217;s &mdash; the difference would be 50 &mdash; and the new bar&#8217;s width would become 50 to match.</p>
<p>You would have to update your knob dragging code as well:</p>
<pre><code>knob.onPress = function():Void {
  clearInterval(idTracking);
  ns.pause(true);
  this.onMouseMove = function():Void {
    if (track._xmouse > 0 &#038;&#038; track._xmouse < loader._width) {
      this._x = track._x + track._xmouse;
      newBarMC._width = knob._x - track._x;
    }
  }
}</code></pre>
]]></content:encoded>
				</item>
	<item>
		<title>by: Daniel</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93811</link>
		<pubDate>Thu, 25 Oct 2007 16:29:01 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93811</guid>
					<description>Hi David,

First of all, thanks for articles. Very usefeull. There's only one more thing i've trying to do but i can't.

Regarding the uTube example i would like a bar to appear with the knob representing the amount of video played.

How can i do that?

Thanks in advance</description>
		<content:encoded><![CDATA[<p>Hi David,</p>
<p>First of all, thanks for articles. Very usefeull. There&#8217;s only one more thing i&#8217;ve trying to do but i can&#8217;t.</p>
<p>Regarding the uTube example i would like a bar to appear with the knob representing the amount of video played.</p>
<p>How can i do that?</p>
<p>Thanks in advance
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: Neal</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93449</link>
		<pubDate>Wed, 24 Oct 2007 08:06:26 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93449</guid>
					<description>David,

Seriously wonderful work, and your answer was spot on correct.

Thanks for all your help,

Neal</description>
		<content:encoded><![CDATA[<p>David,</p>
<p>Seriously wonderful work, and your answer was spot on correct.</p>
<p>Thanks for all your help,</p>
<p>Neal
</p>
]]></content:encoded>
				</item>
	<item>
		<title>by: graeme</title>
		<link>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93376</link>
		<pubDate>Wed, 24 Oct 2007 01:25:31 +0000</pubDate>
		<guid>http://www.quip.net/blog/2007/flash/actionscript-20/how-to-build-flv-load-progress-bar#comment-93376</guid>
					<description>thats exactly it

.........thanks again David</description>
		<content:encoded><![CDATA[<p>thats exactly it</p>
<p>&#8230;&#8230;&#8230;thanks again David
</p>
]]></content:encoded>
				</item>
</channel>
</rss>
