<?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>manewc &#187; Video</title>
	<atom:link href="http://manewc.com/category/video/feed/" rel="self" type="application/rss+xml" />
	<link>http://manewc.com</link>
	<description>iPhone, Flash, Flex, AIR, &#38; Web Development</description>
	<lastBuildDate>Sat, 31 Oct 2009 16:47:47 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.5</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Simple Video Player</title>
		<link>http://manewc.com/2008/06/19/simple-video-player/</link>
		<comments>http://manewc.com/2008/06/19/simple-video-player/#comments</comments>
		<pubDate>Thu, 19 Jun 2008 19:31:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://manewc.com/?p=135</guid>
		<description><![CDATA[So I want to get down the basics of creating a video player and found this code over at adobe. This will just simply pull in an .flv file and automatically play, nothing too glamorous, but will be a good foundation for when I start a project on creating a full player. [ code pulled [...]]]></description>
			<content:encoded><![CDATA[<p>So I want to get down the basics of creating a video player and found this code over at adobe. This will just simply pull in an .flv file and automatically play, nothing too glamorous, but will be a good foundation for when I start a project on creating a full player. [ code pulled from Adobe Docs ]</p>
<pre name="code" class="c-sharp">

package {
    import flash.display.Sprite;
    import flash.events.NetStatusEvent;
    import flash.events.SecurityErrorEvent;
    import flash.media.Video;
    import flash.net.NetConnection;
    import flash.net.NetStream;
    import flash.events.Event;

    public class VideoPlayerExample extends Sprite {
        private var videoURL:String = "path/to/movie.flv";
        private var connection:NetConnection;
        private var stream:NetStream;

        public function VideoPlayerExample() {
            connection = new NetConnection();
            connection.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
             connection.addEventListener(SecurityErrorEvent.SECURITY_ERROR, securityErrorHandler);
            connection.connect(null);
        }

        private function netStatusHandler(event:NetStatusEvent):void {
            switch (event.info.code) {
                case "NetConnection.Connect.Success":
                    connectStream();
                    break;
                case "NetStream.Play.StreamNotFound":
                    trace("Stream not found: " + videoURL);
                    break;
            }
        }

        private function securityErrorHandler(event:SecurityErrorEvent):void {
            trace("securityErrorHandler: " + event);
        }

        private function connectStream():void {
            stream = new NetStream(connection);
            stream.addEventListener(NetStatusEvent.NET_STATUS, netStatusHandler);
            stream.client = new CustomClient();
            var video:Video = new Video();
            video.attachNetStream(stream);
            stream.play(videoURL);
            addChild(video);
        }
    }
}

class CustomClient {
    public function onMetaData(info:Object):void {
        trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
    }
    public function onCuePoint(info:Object):void {
        trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/06/19/simple-video-player/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Video Player with XML and the FLVPlayback and DataGrid Components</title>
		<link>http://manewc.com/2008/04/07/video-player-with-xml-and-the-flvplayback-and-datagrid-components/</link>
		<comments>http://manewc.com/2008/04/07/video-player-with-xml-and-the-flvplayback-and-datagrid-components/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 17:09:08 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Actionscript 3]]></category>
		<category><![CDATA[Flash Components]]></category>
		<category><![CDATA[Video]]></category>

		<guid isPermaLink="false">http://manewc.com/2008/04/07/video-player-with-xml-and-the-flvplayback-and-datagrid-components/</guid>
		<description><![CDATA[I just created a simple video player. I wanted the data grid component to hold a description of the videos in the xml file as well as display the thumbnail image for the movies. In addition to this there is the ability to link to a specified Skin movie to  apply to the video [...]]]></description>
			<content:encoded><![CDATA[<p>I just created a simple video player. I wanted the data grid component to hold a description of the videos in the xml file as well as display the thumbnail image for the movies. In addition to this there is the ability to link to a specified Skin movie to  apply to the video player. Here are a few sites of the classes that I used:</p>
<p><a href="http://www.adobe.com/devnet/flash/quickstart/datagrid_pt3/#section14">http://www.adobe.com/devnet/flash/quickstart/datagrid_pt3/#section14</a></p>
<p><a href="http://www.communitymx.com/content/article.cfm?cid=88033">http://www.communitymx.com/content/article.cfm?cid=88033</a></p>
<p>The XML files holds the location of the thumbnail image, the location of the .flv movie and a description node for a description of the movie. An example of the xml is:</p>
<p>&lt;rss&gt;<br />
&lt;channel&gt;<br />
&lt;item&gt;<br />
&lt;thumbnail&gt;/path/to/thumbnail.jpg&lt;/thumbnail&gt;&lt;flvurl&gt;/path/to/flvmovie.flv&lt;/flvurl&gt;<br />
&lt;description&gt;Here is my description&lt;/description&gt;<br />
&lt;/item&gt;<br />
&lt;item&gt;<br />
&lt;thumbnail&gt;/path/to/thumbnail.jpg&lt;/thumbnail&gt;&lt;flvurl&gt;/path/to/flvmovie.flv&lt;/flvurl&gt;<br />
&lt;description&gt;Here is my description&lt;/description&gt;<br />
&lt;/item&gt;<br />
&lt;/channel&gt;<br />
&lt;/rss&gt;</p>
<p>Here is the main document class used:</p>
<pre class="c-sharp" name="code">
package
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.net.URLLoader;
    import flash.net.URLRequest;
	import fl.controls.DataGrid;
	import fl.controls.dataGridClasses.DataGridColumn;
	import fl.data.DataProvider;

	public class Main extends Sprite
	{
		private var myDataGrid:DataGrid = new DataGrid();
        private var dp:DataProvider;
		private var xml:XML;
		private var fpp:FLVPlaybackPro = new FLVPlaybackPro();

		public function Main()
		{
			var loader:URLLoader = new URLLoader();
            loader.addEventListener(Event.COMPLETE, DataGridLoad);
            loader.load(new URLRequest("/path/to/xml/file.xml"));
		}

		private function DataGridLoad(e:Event):void
		{
			xml = new XML(e.target.data);
			var il:XMLList = xml.channel.item;

			var dp:DataProvider = new DataProvider();

			for (var i:uint=0; i<il.length(); i++)
			{
				dp.addItem({data:il.thumbnail.text()[i], Title:il.description.text()[i], flvurl:il.flvurl.text()[i]});
			}

			var dataCol:DataGridColumn = new DataGridColumn("data");
			dataCol.headerText = "Image";
			dataCol.cellRenderer = LoaderCellRenderer;

			var titleCol:DataGridColumn = new DataGridColumn("Title");

			var flvCol:DataGridColumn = new DataGridColumn("flvurl");

			myDataGrid = new DataGrid();
			myDataGrid.addColumn(dataCol);
			myDataGrid.addColumn(titleCol);
			myDataGrid.dataProvider = dp;
			myDataGrid.rowHeight = 100;
			myDataGrid.width = 500;
			myDataGrid.rowCount = dp.length - 1;
			myDataGrid.move(0, 380);
			addChild(myDataGrid);

			// Listen for Events
			myDataGrid.addEventListener(Event.CHANGE, listClick)

			// Load the player
			FLVPlayer();

			// Play the first video
			FLVPlay(il.flvurl.text()[0]);
		}

		private function FLVPlayer():void
		{
			fpp = new FLVPlaybackPro();

			fpp.x = 0;
			fpp.y = 0;
			fpp.width = 500;
			fpp.height = 333;

			addChild(fpp);

			/* Enter your path to the Flash Skin Component */
			fpp.skin = "SkinUnderAllNoCaption.swf";
			fpp.skinBackgroundColor = 0x666666;
		}

		private function FLVPlay(flvurl:String):void
		{
			fpp.source = flvurl;
		}

		private function listClick(e:Event)
		{
			FLVPlay(myDataGrid.selectedItem.flvurl);
		}

	}
}
</pre>
<p>The FLVPlaybackPro</p>
<pre class="c-sharp" name="code">
package {

    import fl.video.FLVPlayback;

    public class FLVPlaybackPro extends FLVPlayback {

       public function FLVPlaybackPro(){
          super();
       }
    }
}
</pre>
<p>The cell renderer class for the data grid component used:</p>
<pre class="c-sharp" name="code">
package {
    // Import the required component classes.
    import fl.containers.UILoader;
    import fl.controls.listClasses.ICellRenderer;
    import fl.controls.listClasses.ListData;
    import fl.core.InvalidationType;
    import fl.data.DataProvider;
    import flash.events.Event;

    /**
     * This class creates a custom cell renderer which displays an image in a cell.
     * Make sure the class is marked "public" and in the case of our custom cell renderer,
     * extends the UILoader class and implements the ICellRenderer interface.
     */
    public class LoaderCellRenderer extends UILoader implements ICellRenderer {
        protected var _data:Object;
        protected var _listData:ListData;
        protected var _selected:Boolean;

        /**
         * Constructor.
         */
        public function LoaderCellRenderer():void {
            super();
        }

        /**
         * Gets or sets the cell's internal _data property.
         */
        public function get data():Object {
            return _data;
        }
        /**
         * @private (setter)
         */
        public function set data(value:Object):void {
            _data = value;
            source = value.data;
        }

        /**
         * Gets or sets the cell's internal _listData property.
         */
        public function get listData():ListData {
            return _listData;
        }
        /**
         * @private (setter)
         */
        public function set listData(value:ListData):void {
            _listData = value;
            invalidate(InvalidationType.DATA);
            invalidate(InvalidationType.STATE);
        }

        /**
         * Gets or sets the cell's internal _selected property.
         */
        public function get selected():Boolean {
            return _selected;
        }
        /**
         * @private (setter)
         */
        public function set selected(value:Boolean):void {
            _selected = value;
            invalidate(InvalidationType.STATE);
        }

        /**
         * Sets the internal mouse state.
         */
        public function setMouseState(state:String):void {
        }
    }
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://manewc.com/2008/04/07/video-player-with-xml-and-the-flvplayback-and-datagrid-components/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
