<?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>Derek J Entringer &#124; Interactive Media, Web Application, and Mobile App Developer &#187; as2</title>
	<atom:link href="http://www.derekentringer.com/blog/tag/as2/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.derekentringer.com/blog</link>
	<description>Interactive Media Development, Web Application Development, Mobile App Development, Flash, Flash Media Server, Flex, Flash Component Creation, Game Programming &#38; Design, Blog, CMS, eCommerce Setup &#38; Styling, Search Engine Optimization, Social Networking Strategies, Website Interface &#38; Template Creation, Windows Vista Gadget Development, Apple Widget Development, Email Marketing, Code Samples, Tutorials</description>
	<lastBuildDate>Tue, 13 Jul 2010 19:25:15 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Myspace Flash AS2 RSS Feed Reader</title>
		<link>http://www.derekentringer.com/blog/myspace-flash-as2-rss-feed-reader/</link>
		<comments>http://www.derekentringer.com/blog/myspace-flash-as2-rss-feed-reader/#comments</comments>
		<pubDate>Fri, 22 Aug 2008 18:14:53 +0000</pubDate>
		<dc:creator>Derek J Entringer</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[feed]]></category>
		<category><![CDATA[Myspace]]></category>
		<category><![CDATA[reader]]></category>
		<category><![CDATA[rss]]></category>

		<guid isPermaLink="false">http://derekentringer.com/blog/?p=68</guid>
		<description><![CDATA[
			
				
			
		

A very simple RSS feed reader that displays links off to your blog created using Actionscript 2.

stop();
//create the xml object
xmlLoad = new XML();
xmlLoad.load(_root.feed);
xmlLoad.ignoreWhite = true;
xmlLoad.onLoad = function(success){
	//if successful
	if(success &#38;&#38; xmlLoad.status == 0){
		//reset the text
		xml_text=&#34;&#34;;
		//list of items
		var xmlItems:XML = xmlLoad.firstChild.firstChild;
		for (var m = 0; m&#38;lt;xmlItems.childNodes.length; m++) {
			//grab each item
			if (xmlItems.childNodes[m].nodeName == &#34;item&#34;) {
				for (var n = 0; n&#38;lt;xmlItems.childNodes[m].childNodes.length; n++) {
					if (xmlItems.childNodes[m].childNodes[n].nodeName == &#34;link&#34;) {
						//grab the link of the item
						itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
					}
					if (xmlItems.childNodes[m].childNodes[n].nodeName == &#34;title&#34;) {
						//grab the title of the item
						itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
					}
				}
				//add the current item
				xml_text+= &#34;&#38;lt;a href=\&#34;&#34;+itemlink+&#34;\&#34;&#38;gt;&#34;+itemtitle+&#34;&#38;lt;/a&#38;gt;&#38;lt;br&#38;gt;&#38;lt;br&#38;gt;&#34;;
			}
		}
	}
	//set the text
	xml_holder.text = xml_text;
}

The only library item needed ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="clear:left; float:left; margin-top:10px; margin-bottom: 10px; margin-right:12px; margin-left:2px;">
			<a href="http://www.derekentringer.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS50d2VldG1lbWUuY29tL3NoYXJlP3VybD1odHRwJTNBJTJGJTJGd3d3LmRlcmVrZW50cmluZ2VyLmNvbSUyRmJsb2clMkZteXNwYWNlLWZsYXNoLWFzMi1yc3MtZmVlZC1yZWFkZXIlMkY="><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.derekentringer.com%2Fblog%2Fmyspace-flash-as2-rss-feed-reader%2F&amp;source=derekentringer&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p><!--PLAIN_TEXT--><br />
A very simple RSS feed reader that displays links off to your blog created using Actionscript 2.</p>
<pre class="brush: as3;">
stop();
//create the xml object
xmlLoad = new XML();
xmlLoad.load(_root.feed);
xmlLoad.ignoreWhite = true;
xmlLoad.onLoad = function(success){
	//if successful
	if(success &amp;&amp; xmlLoad.status == 0){
		//reset the text
		xml_text=&quot;&quot;;
		//list of items
		var xmlItems:XML = xmlLoad.firstChild.firstChild;
		for (var m = 0; m&amp;lt;xmlItems.childNodes.length; m++) {
			//grab each item
			if (xmlItems.childNodes[m].nodeName == &quot;item&quot;) {
				for (var n = 0; n&amp;lt;xmlItems.childNodes[m].childNodes.length; n++) {
					if (xmlItems.childNodes[m].childNodes[n].nodeName == &quot;link&quot;) {
						//grab the link of the item
						itemlink=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
					}
					if (xmlItems.childNodes[m].childNodes[n].nodeName == &quot;title&quot;) {
						//grab the title of the item
						itemtitle=xmlItems.childNodes[m].childNodes[n].firstChild.toString();
					}
				}
				//add the current item
				xml_text+= &quot;&amp;lt;a href=\&quot;&quot;+itemlink+&quot;\&quot;&amp;gt;&quot;+itemtitle+&quot;&amp;lt;/a&amp;gt;&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&quot;;
			}
		}
	}
	//set the text
	xml_holder.text = xml_text;
}
</pre>
<p>The only library item needed is a TextArea component, placed on the stage with an instance name of &#8220;xml_holder&#8221;.</p>
<p>In order to embed and display this on your Myspace page (or anywhere really) you only need the following code:</p>
<pre class="brush: xml;">
&amp;lt;object data=&quot;http://www.derekentringer.com/downloads/xml_reader/xml_reader.swf?feed=http://www.derekentringer.com/blog/feed/&quot; type=&quot;application/x-shockwave-flash&quot; width=&quot;300&quot; height=&quot;450&quot;&amp;gt;&amp;lt;param name=&quot;movie&quot; value=&quot;http://www.derekentringer.com/downloads/xml_reader/xml_reader.swf?feed=http://www.derekentringer.com/blog/feed/&quot;/&amp;gt;&amp;lt;/object&amp;gt;&lt;br /&gt;
</pre>
<p>Be sure to change the &#8220;?feed&#8221; variable to the url of your own RSS feed.</p>
<p><a href="http://www.derekentringer.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5kZXJla2VudHJpbmdlci5jb20vZG93bmxvYWRzL3htbF9yZWFkZXIveG1sX3JlYWRlci5odG1s" target=\"_blank\">Click here for a preview</a></p>
<p><a href="http://www.derekentringer.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5kZXJla2VudHJpbmdlci5jb20vZG93bmxvYWRzL3htbF9yZWFkZXIuemlw" target=\"_blank\">Download the source</a></p>
 <img src="http://www.derekentringer.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=68" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.derekentringer.com/blog/myspace-flash-as2-rss-feed-reader/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>FLV Player (Progressive Download) with Preloader</title>
		<link>http://www.derekentringer.com/blog/flv-player-progressive-download-with-preloader/</link>
		<comments>http://www.derekentringer.com/blog/flv-player-progressive-download-with-preloader/#comments</comments>
		<pubDate>Thu, 21 Aug 2008 16:41:02 +0000</pubDate>
		<dc:creator>Derek J Entringer</dc:creator>
				<category><![CDATA[Code Samples]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[as2]]></category>
		<category><![CDATA[controls]]></category>
		<category><![CDATA[download]]></category>
		<category><![CDATA[flv]]></category>
		<category><![CDATA[pause]]></category>
		<category><![CDATA[play]]></category>
		<category><![CDATA[player]]></category>
		<category><![CDATA[progressive]]></category>
		<category><![CDATA[rewind]]></category>
		<category><![CDATA[scrubbing]]></category>
		<category><![CDATA[simple]]></category>
		<category><![CDATA[tutorial]]></category>
		<category><![CDATA[volume]]></category>

		<guid isPermaLink="false">http://derekentringer.com/blog/?p=47</guid>
		<description><![CDATA[
			
				
			
		

Here I have all of the code necessary to setup a simple AS2 flv player using progressive download. All of this script is in the first frame of the movie with the appropriate movie clips available on the stage.
First, We setup all of our controls including our Play/Pause button, Rewind, Scrubbing, and volume controls.


stop();

/*--------------------------------------------------------------------------------*/
//sound settings/controls
/*--------------------------------------------------------------------------------*/

globalsound = new Sound();
globalsound.setVolume(100);
volume_slide.volume_slider._x = volume_slide.volume_bar._width-volume_slide.volume_slider._width;

b_volume.onRelease = function() {
	if(globalsound.getVolume() == 100){
		b_volume.gotoAndStop(2);
		globalsound.setVolume(0);
	}else if(globalsound.getVolume() == 0){
		b_volume.gotoAndStop(1);
		globalsound.setVolume(100);
	}
}

//volume scrubbing
var pTop_volume:Number = volume_slide.volume_slider._y;
var pLeft_volume:Number = 0;
var pBottom_volume:Number = volume_slide.volume_slider._y;
var pRight_volume:Number = volume_slide.volume_bar._width-volume_slide.volume_slider._width;

volume_slide.volume_slider.onPress = function() {
	startDrag(&#34;volume_slide.volume_slider&#34;, false, pLeft_volume, pTop_volume, pRight_volume, pBottom_volume);
	dragging = ...]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="clear:left; float:left; margin-top:10px; margin-bottom: 10px; margin-right:12px; margin-left:2px;">
			<a href="http://www.derekentringer.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL2FwaS50d2VldG1lbWUuY29tL3NoYXJlP3VybD1odHRwJTNBJTJGJTJGd3d3LmRlcmVrZW50cmluZ2VyLmNvbSUyRmJsb2clMkZmbHYtcGxheWVyLXByb2dyZXNzaXZlLWRvd25sb2FkLXdpdGgtcHJlbG9hZGVyJTJG"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.derekentringer.com%2Fblog%2Fflv-player-progressive-download-with-preloader%2F&amp;source=derekentringer&amp;style=normal&amp;service=TinyURL.com" height="61" width="50" /><br />
			</a>
		</div>
<p><!--PLAIN_TEXT--></p>
<p>Here I have all of the code necessary to setup a simple AS2 flv player using progressive download. All of this script is in the first frame of the movie with the appropriate movie clips available on the stage.</p>
<p>First, We setup all of our controls including our Play/Pause button, Rewind, Scrubbing, and volume controls.</p>
<pre class="brush: as3;">

stop();

/*--------------------------------------------------------------------------------*/
//sound settings/controls
/*--------------------------------------------------------------------------------*/

globalsound = new Sound();
globalsound.setVolume(100);
volume_slide.volume_slider._x = volume_slide.volume_bar._width-volume_slide.volume_slider._width;

b_volume.onRelease = function() {
	if(globalsound.getVolume() == 100){
		b_volume.gotoAndStop(2);
		globalsound.setVolume(0);
	}else if(globalsound.getVolume() == 0){
		b_volume.gotoAndStop(1);
		globalsound.setVolume(100);
	}
}

//volume scrubbing
var pTop_volume:Number = volume_slide.volume_slider._y;
var pLeft_volume:Number = 0;
var pBottom_volume:Number = volume_slide.volume_slider._y;
var pRight_volume:Number = volume_slide.volume_bar._width-volume_slide.volume_slider._width;

volume_slide.volume_slider.onPress = function() {
	startDrag(&quot;volume_slide.volume_slider&quot;, false, pLeft_volume, pTop_volume, pRight_volume, pBottom_volume);
	dragging = true;
	this.onEnterFrame = function() {
		globalsound.setVolume((volume_slide.volume_slider._x)*(volume_slide.volume_bar._width/25));
		trace((volume_slide.volume_slider._x)*(volume_slide.volume_bar._width/25));
	};
};
volume_slide.volume_slider.onRelease = function() {
	dragging = false;
	stopDrag();
	delete this.onEnterFrame;
};
volume_slide.volume_slider.onReleaseOutside = function() {
	dragging = false;
	stopDrag();
	delete this.onEnterFrame;
};

/*--------------------------------------------------------------------------------*/
//play/pause controls
/*--------------------------------------------------------------------------------*/

b_play.onRelease = function() {
	if (b_play._currentframe == 1) {
		ns.pause();
		b_play.gotoAndStop(2);
	} else {
		ns.pause();
		b_play.gotoAndStop(1);
	}
};
b_rewind.onRelease = function() {
	ns.seek(0);
}
</pre>
<p>Next, we tell flash where to find our flv file. I have not included any automatic Meta Data Handlers, so we also have to specify the length of the video in order to properly setup the scrub bar. Again, this is just to keep it simple.</p>
<pre class="brush: as3;">

/*--------------------------------------------------------------------------------*/
//video loading/controls
/*--------------------------------------------------------------------------------*/

//main video directory
var dir = &quot;path/to/your/flv&quot;;

//video properties
var vid = &quot;name of your flv&quot;;
var vid_length = &quot;length of your flv in seconds&quot;;
</pre>
<p>Here we have our NetConnection setup with our bufferTime, and I am also calling two custom functions: drawLoader, and timing. The drawLoader function is the preloader, and the timing will setup our scrub bar.</p>
<pre class="brush: as3;">

var nc:NetConnection = new NetConnection();
nc.connect(null);
var ns:NetStream = new NetStream(nc);
video.attachVideo(ns);
ns.setBufferTime(15);
ns.play(dir+vid);
ns.pause();
drawLoader();
timing(vid_length);

/*--------------------------------------------------------------------------------*/
//scrubber functions
/*--------------------------------------------------------------------------------*/

function timing(fTime:Number) {
	//the length of the movie
	var finalTime:Number = fTime;
	var time_interval:Number = setInterval(checkTime, 10, ns);
	//function for the interval
	function checkTime(ns:NetStream) {
	   //movie time
	   var ns_seconds:Number = ns.time;
	   //parameters for the scrubber
	   var finalWidth:Number = timer_bar.slider._width-timer_bar.scrubber._width;
	   var movVar:Number = finalWidth/finalTime;
	   timer_bar.scrubber._x = movVar*ns_seconds;
	   //values for the scrubber position
	   var pTop:Number = timer_bar.scrubber._y;
	   var pLeft:Number = 0;
	   var pBottom:Number = timer_bar.scrubber._y;
	   var pRight:Number = timer_bar.slider._width-timer_bar.scrubber._width;
	   //scrubber is pressed
	   timer_bar.scrubber.onPress = function() {
	       clearInterval(time_interval);
	       //dragging
	       startDrag(&quot;timer_bar.scrubber&quot;, false, pLeft, pTop, pRight, pBottom);
	       dragging = true;
	       //seek as scrubber is moved
	       this.onEnterFrame = function() {
	           ns_seconds = this._x/movVar;
	           ns.seek(ns_seconds);
	       };
	   };
	   timer_bar.scrubber.onRelease = function() {
	       dragging = false;
	       stopDrag();
	       delete this.onEnterFrame;
	       time_interval = setInterval(checkTime, 10, ns);
	   };
	   timer_bar.scrubber.onReleaseOutside = function() {
	       dragging = false;
	       stopDrag();
	       delete this.onEnterFrame;
	       time_interval = setInterval(checkTime, 10, ns);
	   };
	}
}

/*--------------------------------------------------------------------------------*/
//preloading functions
/*--------------------------------------------------------------------------------*/

function drawLoader() {

	video.clear();

	loading._visible = true;
	progressBar_mc._visible = true;
	createEmptyMovieClip(&quot;progressBar_mc&quot;,getNextHighestDepth());
	progressBar_mc.createEmptyMovieClip(&quot;bar_mc&quot;,progressBar_mc.getNextHighestDepth());

	with (progressBar_mc.bar_mc) {
		beginFill(0xD7D7D9);
		moveTo(0,0);
		lineTo(100,0);
		lineTo(100,10);
		lineTo(0,10);
		lineTo(0,0);
		endFill();
		_xscale = 0;
		_alpha = 90;
	}
	progressBar_mc.createEmptyMovieClip(&quot;stroke_mc&quot;,progressBar_mc.getNextHighestDepth());

	with (progressBar_mc.stroke_mc) {
		lineStyle(0,0xD7D7D9);
		moveTo(0,0);
		lineTo(100,0);
		lineTo(100,10);
		lineTo(0,10);
		lineTo(0,0);
		_alpha = 90;
	}
	progressBar_mc._x = 140;
	progressBar_mc._y = 115;

	var loaded_interval:Number = setInterval(checkBytesLoaded, 150);

	function checkBytesLoaded() {

		var pctLoaded_1:Number = Math.round(ns.bytesLoaded/ns.bytesTotal*100);
		pctLoaded_total = pctLoaded_1;
		trace(&quot;total loaded= &quot;+pctLoaded_total);
		progressBar_mc.bar_mc._xscale = pctLoaded_total*2;

		if (pctLoaded_total&gt;=50) {

			ns.seek(0);
			ns.pause();

			clearInterval(loaded_interval);
			progressBar_mc._visible = false;
			loading._visible = false;
			unloadMovie(progressBar_mc.stroke_mc);
			unloadMovie(progressBar_mc.bar_mc);
			unloadMovie(progressBar_mc);

		}
	}
}
</pre>
<p>The result:</p>
<p><img src="http://www.derekentringer.com/img/flv_player_example.jpg" border="0" /></p>
<p><a href="http://www.derekentringer.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?url=aHR0cDovL3d3dy5kZXJla2VudHJpbmdlci5jb20vZG93bmxvYWRzL2Zsdl9wbGF5ZXIuemlw">Download the source</a></p>
 <img src="http://www.derekentringer.com/blog/wp-content/plugins/wordpress-feed-statistics/feed-statistics.php?view=1&post_id=47" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://www.derekentringer.com/blog/flv-player-progressive-download-with-preloader/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
