<?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/"
		xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd"
	xmlns:media="http://search.yahoo.com/mrss/"
>

<channel>
	<title>MMP 420 &#187; netconnection</title>
	<atom:link href="http://mmp420.blogs.peopleio.net/tag/netconnection/feed/" rel="self" type="application/rss+xml" />
	<link>http://mmp420.blogs.peopleio.net</link>
	<description>Just another BMCC Multimedia Blogs weblog</description>
	<lastBuildDate>Mon, 30 Nov 2009 22:25:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
	<copyright>2006-2007 </copyright>
	<managingEditor>prof.stein@gmail.com (MMP 420)</managingEditor>
	<webMaster>prof.stein@gmail.com (MMP 420)</webMaster>
	<image>
		<url>http://mmp420.blogs.peopleio.net/wp-content/plugins/podpress/images/powered_by_podpress.jpg</url>
		<title>MMP 420</title>
		<link>http://mmp420.blogs.peopleio.net</link>
		<width>144</width>
		<height>144</height>
	</image>
	<itunes:subtitle></itunes:subtitle>
	<itunes:summary>Just another BMCC Multimedia Blogs weblog</itunes:summary>
	<itunes:keywords></itunes:keywords>
	<itunes:category text="Society &#38; Culture" />
	<itunes:author>MMP 420</itunes:author>
	<itunes:owner>
		<itunes:name>MMP 420</itunes:name>
		<itunes:email>prof.stein@gmail.com</itunes:email>
	</itunes:owner>
	<itunes:block>no</itunes:block>
	<itunes:explicit>no</itunes:explicit>
	<itunes:image href="http://mmp420.blogs.peopleio.net/wp-content/plugins/podpress/images/powered_by_podpress_large.jpg" />
		<item>
		<title>Problem with movie in class</title>
		<link>http://mmp420.blogs.peopleio.net/2009/01/28/problem-with-movie-in-class/</link>
		<comments>http://mmp420.blogs.peopleio.net/2009/01/28/problem-with-movie-in-class/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 07:22:30 +0000</pubDate>
		<dc:creator>Christopher Stein</dc:creator>
				<category><![CDATA[actionscript]]></category>
		<category><![CDATA[Class Info]]></category>
		<category><![CDATA[fms]]></category>
		<category><![CDATA[netconnection]]></category>

		<guid isPermaLink="false">http://mmp420.blogs.peopleio.net/?p=38</guid>
		<description><![CDATA[This post is about why my code wasn&#8217;t working and also explains more about the parts that are needed to make a connection work in general. While I&#8217;m sorry I didn&#8217;t catch the mistakes in class at least you got to see that we all make mistakes and forget things. My code wasn&#8217;t working at [...]]]></description>
			<content:encoded><![CDATA[<p>This post is about why my code wasn&#8217;t working and also explains more about the parts that are needed to make a connection work in general. While I&#8217;m sorry I didn&#8217;t catch the mistakes in class at least you got to see that we all make mistakes and forget things.</p>
<p>My code wasn&#8217;t working at the end of class because I forgot two very important things with the shared object. I didn&#8217;t create it and I didn&#8217;t connect it. It&#8217;s a good time to point out that both the SharedObject and the NetConnection object have four things they need to work properly:</p>
<ol>
<li>Create the Object</li>
<li>Add and Event Listener</li>
<li>Connect the Object</li>
<li>Write the Event Handler</li>
</ol>
<p>Here is how that works for each of them<span id="more-38"></span></p>
<h3>NetConnection Object</h3>
<ol>
<li>CREATE<br />client_nc = new NetConnection();</li>
<li>ADD EVENT LISTENER<br />client_nc.addEventListener(NetStatusEvent.NET_STATUS, ncStatus);</li>
<li>CONNECT<br />client_nc.connect(&#8220;rtmp://mmp.bmcc.cuny.edu/example&#8221;);</li>
<li>EVENT HANDLER<br />function ncStatus(evt:NetStatusEvent) {<br />
              &nbsp;&nbsp;&nbsp;&nbsp; trace(evt.info.code);<br />
}</li>
</ol>
<p>Remember the first three lines go in the Main constructor function and the ncStatus function separate.</p>
<h3>SharedObject</h3>
<ol>
<li>CREATE<br />my_so = SharedObject.getRemote(&#8220;ChatObject&#8221;, client_nc.uri);</li>
<li>ADD EVENT LISTENER<br />my_so.addEventListener(SyncEvent.SYNC, soSync);</li>
<li>CONNECT<br />my_so.connect(client_nc);</li>
<li>EVENT HANDLER<br />function soSync(evt:SyncEvent) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;trace(&#8220;synced&#8221;);<br />
}</li>
</ol>
<p>Again the first three steps are in the constructor function and the event handler is separate.</p>
<p>How you create the SharedObject is a little different from how you create most objects. Instead of using the new keyword ( like new SharedObject() ), you use the getRemote() method. This method needs two parameters. The first is the name of the SharedObject, I called it &#8220;ChatObject&#8221; here. This name is a string that you make up. It is important because if two movies use a different name for the SharedObject then they will not talk to each other. The second parameter is is the same connection string you usedin step 3 of the NetConnection object. However instead of having to write it twice you can just use client_nc.uri and it will use the URI from the NetConnection Object.</p>
<p>Also notice that when you connect the SharedObject you add a reference to the client_nc again (without the uri part this time).</p>
<p>Here is a file with an example of those connections</p>
<p><a href="http://mmp420.blogs.peopleio.net/files/2009/01/main1.as">main1</a><!--more--></p>
<p><a class="a2a_dd a2a_target addtoany_share_save" href="http://www.addtoany.com/share_save#url=http%3A%2F%2Fmmp420.blogs.peopleio.net%2F2009%2F01%2F28%2Fproblem-with-movie-in-class%2F&amp;title=Problem%20with%20movie%20in%20class" id="wpa2a_2"><img src="http://mmp420.blogs.peopleio.net/wp-content/plugins/add-to-any/share_save_171_16.png" width="171" height="16" alt="Share"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://mmp420.blogs.peopleio.net/2009/01/28/problem-with-movie-in-class/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

