<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Bloom Blog&#187; actonscript 2.0</title>
	<atom:link href="http://www.bloomagency.co.uk/blog/tag/actonscript-20/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.bloomagency.co.uk/blog</link>
	<description></description>
	<lastBuildDate>Fri, 13 Jan 2012 17:31:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>How to preload FLV video in flash with actionscript 2.0</title>
		<link>http://www.bloomagency.co.uk/blog/technical/preload-flv-video-in-flash-actionscript-20-2/</link>
		<comments>http://www.bloomagency.co.uk/blog/technical/preload-flv-video-in-flash-actionscript-20-2/#comments</comments>
		<pubDate>Wed, 20 Aug 2008 14:16:49 +0000</pubDate>
		<dc:creator>Dominic Kelly</dc:creator>
				<category><![CDATA[Technical]]></category>
		<category><![CDATA[actonscript 2.0]]></category>

		<guid isPermaLink="false">http://www.bloomagency.co.uk/blog/?p=40</guid>
		<description><![CDATA[Since the introduction of Flash video (flv) in 2002, Flash Player has become the most widely installed Internet video client, running on over 96% of all Internet-connected PCs. The ubiquity of Flash Player ensures that most visitors can view Flash &#8230; <a href="http://www.bloomagency.co.uk/blog/technical/preload-flv-video-in-flash-actionscript-20-2/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p><img src="http://www.bloomagency.co.uk/blog/wp-content/uploads/2008/08/team_vid.jpg" alt="team_vid" title="team_vid" width="518" height="178" class="alignnone size-full wp-image-142" /></p>
<p>Since the introduction of Flash video (flv) in 2002, Flash Player has become the most widely installed Internet video client, running on over 96% of all Internet-connected PCs. The ubiquity of Flash Player ensures that most visitors can view Flash video without downloading additional plug-ins, so you can reach more people with lower development, testing, and support costs.</p>
<p>Flash video can be delivered either via a streaming server, which allows for on-demand/live video, or via the more commonly used progressive download method. Progressively downloaded videos do not start until a proportion of the video has downloaded to the client, ensuring a smooth un-interupted video experience.</p>
<p>While this is fine and dandy, what happens when you want the entire video to download before it begins to play, or if you have <a rel="nofollow" href="http://www.bloomagency.co.uk/about_bloom/our_team/"  target="_blank">several</a> bandwidth intensive videos as is the case of our own <a rel="nofollow" href="http://www.bloomagency.co.uk/about_bloom/our_team/" >&#8220;Meet the Team&#8221;</a> page. In either case, preloading flv&#8217;s is not a documented feature, and it must therefore be simulated.</p>
<p>What follows is one method you can use to simulate preloading Flash video files, including a progress bar and percentage label.</p>
<pre lang="ACTIONSCRIPT">
/**
* Preloading FLVs with progressbar
*
* Actionscript developed by Bloom Media Ltd. | www.bloommedia.co.uk
* Contributors: Dominic Kelly
*/

// open a net connection
var nc:NetConnection = new NetConnection();
// null connection for progressive download
nc.connect(null);

// create a stream
myNetStream = new NetStream(nc);
myVideo.attachVideo(myNetStream);
// load video
myNetStream.play("dom-kelly.flv");
// pause video to hide it from the stage
myNetStream.pause();

// hide load progress
percentage._visible = false;
percentage._visible = false;

// resize video onload, based on meta data
myNetStream.onMetaData = function(obj)
{
	myVideo._height = obj.height;
	myVideo._width = obj.width;
	// show load progress
	percentage._visible = true;
	percentage._visible = true;
};

// listen for the 'Stop' status event, and restart the video to loop it
myNetStream.onStatus = function(info)
{
	if (info.code == "NetStream.Play.Stop")
	{
		this.seek(0);
	}
};

// create a preload interval to check load progress every 1 millisecond
myInterval = setInterval(checkBytesLoaded, 1, myNetStream);

// preload loop progress
function checkBytesLoaded(mns)
{
	// calculate percentage of video that has downloaded
	pctLoaded = Math.round(mns.bytesLoaded / mns.bytesTotal * 100);

	// update textfield on the stage
	percentage.text = pctLoaded + "%";

	// update progress bar on the stage
	progressBar._xscale = pctLoaded;

	if (pctLoaded &gt;= 100)	{
		// the video has fully downloaded
		_root.percentage.text = "loaded";
		// play video from the beginning
		mns.seek(0);
		mns.play("dom-kelly.flv");
		// clear interval
		clearInterval(myInterval);
	}
}</pre>
<p>And there you have it, a simple and effective flv preloader.</p>
<p>View the <a rel="nofollow" href="http://www.bloomagency.co.uk/flash-actionscript-preload-flv/"  target="_blank">demo</a> or download the <a rel="nofollow" href="http://www.bloomagency.co.uk/flash-actionscript-preload-flv/preload-flv.fla"  target="_blank">source code</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.bloomagency.co.uk/blog/technical/preload-flv-video-in-flash-actionscript-20-2/feed/</wfw:commentRss>
		<slash:comments>81</slash:comments>
		</item>
	</channel>
</rss>
<!-- This Quick Cache file was built for (  www.bloomagency.co.uk/blog/tag/actonscript-20/feed/ ) in 1.41798 seconds, on Feb 7th, 2012 at 9:30 am UTC. -->
<!-- This Quick Cache file will automatically expire ( and be re-built automatically ) on Feb 14th, 2012 at 9:30 am UTC -->
