<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
	
	>
<channel>
	<title>
	Comments on: Porting Flashcom Applications to ActionScript 3	</title>
	<atom:link href="https://jessewarden.com/2006/07/porting-flashcom-applications-to-actionscript-3.html/feed" rel="self" type="application/rss+xml" />
	<link>https://jessewarden.com/2006/07/porting-flashcom-applications-to-actionscript-3.html</link>
	<description>Software &#124; Fitness &#124; Gaming</description>
	<lastBuildDate>Wed, 07 Nov 2007 19:21:05 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	
	<item>
		<title>
		By: Garth Gerstein		</title>
		<link>https://jessewarden.com/2006/07/porting-flashcom-applications-to-actionscript-3.html/comment-page-1#comment-24266</link>

		<dc:creator><![CDATA[Garth Gerstein]]></dc:creator>
		<pubDate>Wed, 07 Nov 2007 19:21:05 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1034#comment-24266</guid>

					<description><![CDATA[I could get the server calls to the client working fine using the method that JesterXL described like this.  

application.onConnect(myclient)
{
  this.acceptConnection(myclient);

  myclient(&quot;methodToCall&quot;, null, args);

}

on the client side I did have to define the method being called as a method in an external public class and pass it to the client property of the NetConnection object like this:

//external class

package{
 public ExternalClass{

    public ExternalClass(){
      //empty constructor
    }

    public methodToCall(args)
    {
         trace(args);
    }
 }
}

in the main timeline of the client swf

var newPublicObject:ExternalClass = new ExternalClass();

var my_nc:NetConnection = new NetConnection();
my_nc.client = newPublicObject;

my_nc.connect(rtmp://www.domain.com/applicaitonName/AppInstance);


This all works fine, but I cannot get any call to work where the client calls a server method. According to the documentation, you have to define the server side method on the Client Object that is passed to the onConnect Event in the application main.asc. That right there sounds like a name space problem to me, since that is also where you call client side methods right? 

It is supposed to go something like this on the server side:

application.onConnect(myclient)
{

   this.acceptConnection(myclient);

  myclient.methodToCall = function()
  {
      return &quot;someString&quot;;
  }
}

The client swf calls the method using the NetConnection call method:

my_nc.call(&quot;methodToCall&quot;,null, args);

the second parameter is a Responder Class object that you can define. It is used to set up functions to handle return values if the call succeeds or fails like this:

var myResponder:Responder = new Responder(successFunction, failFunction);

so you could change the NetConnection call to 

my_nc.call(&quot;methodToCall&quot;,myResponder,args);

If the call fails it sends a return object to the failFunction that has three properties...
level
code
description  - This one tells you why it failed

so you can set up the failFunction like this:

function failFunction(e:Object)
{
  //Note that the return object is just a generic object not an error object
  trace(e.descriptoin);
}


This always traces as Method not found no matter how I try to define the method on the server side

I have tried every method that they show in the server documentation and I can&#039;t get the client to call a server side function. One guess was the AMF encoding so I set that to 0 for the earlier encoding method that is suppported by FMS 2 and that eliminated IO Errors being returned from the NetConnection object, but it did not solve the issue of callling server side functions. This is a big problem. I am going to try creating server side classes that might also solve the scoping issue on the server side the way it did on the client side and see if that works. Let me know if anyone solves this one. Thanks.]]></description>
			<content:encoded><![CDATA[<p>I could get the server calls to the client working fine using the method that JesterXL described like this.  </p>
<p>application.onConnect(myclient)<br />
{<br />
  this.acceptConnection(myclient);</p>
<p>  myclient(&#8220;methodToCall&#8221;, null, args);</p>
<p>}</p>
<p>on the client side I did have to define the method being called as a method in an external public class and pass it to the client property of the NetConnection object like this:</p>
<p>//external class</p>
<p>package{<br />
 public ExternalClass{</p>
<p>    public ExternalClass(){<br />
      //empty constructor<br />
    }</p>
<p>    public methodToCall(args)<br />
    {<br />
         trace(args);<br />
    }<br />
 }<br />
}</p>
<p>in the main timeline of the client swf</p>
<p>var newPublicObject:ExternalClass = new ExternalClass();</p>
<p>var my_nc:NetConnection = new NetConnection();<br />
my_nc.client = newPublicObject;</p>
<p>my_nc.connect(rtmp://www.domain.com/applicaitonName/AppInstance);</p>
<p>This all works fine, but I cannot get any call to work where the client calls a server method. According to the documentation, you have to define the server side method on the Client Object that is passed to the onConnect Event in the application main.asc. That right there sounds like a name space problem to me, since that is also where you call client side methods right? </p>
<p>It is supposed to go something like this on the server side:</p>
<p>application.onConnect(myclient)<br />
{</p>
<p>   this.acceptConnection(myclient);</p>
<p>  myclient.methodToCall = function()<br />
  {<br />
      return &#8220;someString&#8221;;<br />
  }<br />
}</p>
<p>The client swf calls the method using the NetConnection call method:</p>
<p>my_nc.call(&#8220;methodToCall&#8221;,null, args);</p>
<p>the second parameter is a Responder Class object that you can define. It is used to set up functions to handle return values if the call succeeds or fails like this:</p>
<p>var myResponder:Responder = new Responder(successFunction, failFunction);</p>
<p>so you could change the NetConnection call to </p>
<p>my_nc.call(&#8220;methodToCall&#8221;,myResponder,args);</p>
<p>If the call fails it sends a return object to the failFunction that has three properties&#8230;<br />
level<br />
code<br />
description  &#8211; This one tells you why it failed</p>
<p>so you can set up the failFunction like this:</p>
<p>function failFunction(e:Object)<br />
{<br />
  //Note that the return object is just a generic object not an error object<br />
  trace(e.descriptoin);<br />
}</p>
<p>This always traces as Method not found no matter how I try to define the method on the server side</p>
<p>I have tried every method that they show in the server documentation and I can&#8217;t get the client to call a server side function. One guess was the AMF encoding so I set that to 0 for the earlier encoding method that is suppported by FMS 2 and that eliminated IO Errors being returned from the NetConnection object, but it did not solve the issue of callling server side functions. This is a big problem. I am going to try creating server side classes that might also solve the scoping issue on the server side the way it did on the client side and see if that works. Let me know if anyone solves this one. Thanks.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: JesterXL		</title>
		<link>https://jessewarden.com/2006/07/porting-flashcom-applications-to-actionscript-3.html/comment-page-1#comment-3625</link>

		<dc:creator><![CDATA[JesterXL]]></dc:creator>
		<pubDate>Mon, 06 Nov 2006 20:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1034#comment-3625</guid>

					<description><![CDATA[Not sure if I blogged it, but can&#039;t find the link now.  Bottom line, you just change the this.callPrefix on the server-side for client.call&#039;s.  Then, you have the client parse this string and dispatch the calls to the components manually.

So, this:

client.call(this.callPrefix + &#039;method&#039;, null);

becomes:

client.call(&#039;method&#039;, null, this.callPrefix);

You then have your client property, typically a class, handle the routing.  See the comments in the &lt;a href=&quot;http://www.jessewarden.com/archives/2006/07/netconnection_s.html&quot; rel=&quot;nofollow&quot;&gt;previous post&lt;/a&gt;.]]></description>
			<content:encoded><![CDATA[<p>Not sure if I blogged it, but can&#8217;t find the link now.  Bottom line, you just change the this.callPrefix on the server-side for client.call&#8217;s.  Then, you have the client parse this string and dispatch the calls to the components manually.</p>
<p>So, this:</p>
<p>client.call(this.callPrefix + &#8216;method&#8217;, null);</p>
<p>becomes:</p>
<p>client.call(&#8216;method&#8217;, null, this.callPrefix);</p>
<p>You then have your client property, typically a class, handle the routing.  See the comments in the <a href="http://www.jessewarden.com/archives/2006/07/netconnection_s.html" rel="nofollow">previous post</a>.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Sander Kruger		</title>
		<link>https://jessewarden.com/2006/07/porting-flashcom-applications-to-actionscript-3.html/comment-page-1#comment-3624</link>

		<dc:creator><![CDATA[Sander Kruger]]></dc:creator>
		<pubDate>Mon, 06 Nov 2006 17:48:23 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1034#comment-3624</guid>

					<description><![CDATA[Hello Jesse,

Thanks for posting this message. I&#039;ve been at it porting an FMS application to Actionscript 3.0 and Flex for a week and couldn&#039;t get the method calls with NetConnection to work. It&#039;s consoling that I&#039;m not the only one having problems.

I&#039;m using Influxis as a hosting, so there&#039;s no easy way to circumvent the object decoration that is used as a namespace mechanism: The standard components use the /-substitution and cannot be overriden, unless I rewrite the whole component framework.

When I use a dynamic class as client for the NetConnection object on the client-side, the debugger never complains when it cannot find a method, so this isn&#039;t very helpful. Next, I tried to use a static class and yes, the debugger signals an exception when a method cannot be found, but only if the server-side call was not decorated with class and instance.

Then, I tried to extend the Proxy class and use it as a client object for NetConnection to see what exactly is happening on the client side. Unfortunately to no avail. It seems like the method calls with slashes in them are just plainly ignored by Flash Player 9.

The experiment with Proxy did reveil something interesting, though. It turns out that Flash Player 9 doesn&#039;t actually &#039;call&#039; the function on the client object. Instead, it &#039;get&#039;s the function as a property and then calls it as a method on some different object.

It&#039;s a mistery to me how Flash Player decides what object to call the method on, but it looks like it has to do with the last created instance of the class that the method belongs to.

Well, I hope this gives some avenues of inquiry for other readers and that some of you may shed some light on this.]]></description>
			<content:encoded><![CDATA[<p>Hello Jesse,</p>
<p>Thanks for posting this message. I&#8217;ve been at it porting an FMS application to Actionscript 3.0 and Flex for a week and couldn&#8217;t get the method calls with NetConnection to work. It&#8217;s consoling that I&#8217;m not the only one having problems.</p>
<p>I&#8217;m using Influxis as a hosting, so there&#8217;s no easy way to circumvent the object decoration that is used as a namespace mechanism: The standard components use the /-substitution and cannot be overriden, unless I rewrite the whole component framework.</p>
<p>When I use a dynamic class as client for the NetConnection object on the client-side, the debugger never complains when it cannot find a method, so this isn&#8217;t very helpful. Next, I tried to use a static class and yes, the debugger signals an exception when a method cannot be found, but only if the server-side call was not decorated with class and instance.</p>
<p>Then, I tried to extend the Proxy class and use it as a client object for NetConnection to see what exactly is happening on the client side. Unfortunately to no avail. It seems like the method calls with slashes in them are just plainly ignored by Flash Player 9.</p>
<p>The experiment with Proxy did reveil something interesting, though. It turns out that Flash Player 9 doesn&#8217;t actually &#8216;call&#8217; the function on the client object. Instead, it &#8216;get&#8217;s the function as a property and then calls it as a method on some different object.</p>
<p>It&#8217;s a mistery to me how Flash Player decides what object to call the method on, but it looks like it has to do with the last created instance of the class that the method belongs to.</p>
<p>Well, I hope this gives some avenues of inquiry for other readers and that some of you may shed some light on this.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Jesse Warden - Flash, Flex, and Component Developer		</title>
		<link>https://jessewarden.com/2006/07/porting-flashcom-applications-to-actionscript-3.html/comment-page-1#comment-3626</link>

		<dc:creator><![CDATA[Jesse Warden - Flash, Flex, and Component Developer]]></dc:creator>
		<pubDate>Sat, 02 Sep 2006 23:02:46 +0000</pubDate>
		<guid isPermaLink="false">http://jessewarden.com/?p=1034#comment-3626</guid>

					<description><![CDATA[&lt;strong&gt;Server-Side FFmpeg Converter: Flash, ARP, &amp; SWFStudio&lt;/strong&gt;

Preface As part of my Flash &amp; Flex speech I&#039;ve been giving throughout the year, I wanted to create a real-world app where you would want utilize Flash &amp; Flex together. Back in late July, I started creating a YouTube...
]]></description>
			<content:encoded><![CDATA[<p><strong>Server-Side FFmpeg Converter: Flash, ARP, &#038; SWFStudio</strong></p>
<p>Preface As part of my Flash &#038; Flex speech I&#8217;ve been giving throughout the year, I wanted to create a real-world app where you would want utilize Flash &#038; Flex together. Back in late July, I started creating a YouTube&#8230;</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
