« Return to Thread: Typed Objects from AS2 to .NET Assembly

Re: Typed Objects from AS2 to .NET Assembly

by Peter Banfield :: Rate this Message:

Reply (Restricted by the Administrator) | Reply to Author | View in Thread

Some parts of this message have been removed. Learn more about Nabble's security policy.
Try registering the class inside the value object's constructor rather than inside your search command like so.


class com.search.SearchVO {
   
    public function SearchVO(){
        Object.registerClass("com.search.SearchVO", SearchVO);
    }
}

Not really sure if that should make a difference. Also noticing that you aren't using com.TheSilentGroup.Fluorine in your service. Although I'm not actually sure why I've got that in my implementation as I don't see it being used. Perhaps it just got left there at some point. It's been a couple years since I've looked at this code.

Hope this helps.

Peter

Ed Haack <ed@...> wrote:
Thank you for your responses, and I have spent the last few days pouring over the docs, and what I’m trying to do is send a custom class object FROM Actionscript (via Flash 8/AS2) to a .NET Assembly (2.0). Rather than talk theory, here’s my code:
 
AS2 Flash, Sample App – on the frame:
import mx.remoting.Service;
import mx.remoting.PendingCall;
import mx.rpc.RelayResponder;
import mx.rpc.ResultEvent;
import Fluorine.Stuff;
Object.registerClass("Fluorine.Stuff", Fluorine.Stuff);
var stuff:Stuff = new Stuff();
stuff.Name = "Ed";
var remotingService:Service = new Service('http://localhost/fluorine/gateway.aspx', null, 'Fluorine.FlashRemoting');
var pc:PendingCall = remotingService.Hello(stuff);
pc.responder = new RelayResponder(_root, "FlashRemoting_onSuccess", "FlashRemoting_onFault");
function FlashRemoting_onFault(fault)
{
       trace("Error: " + fault.fault.faultstring);
}
function FlashRemoting_onSuccess(re:ResultEvent)
{
       trace("Success! : " + re.result);
}
 
============================
AS2 Custom/Object Class:
class Fluorine.Stuff
{
       private var _name:String;
       public function get Name():String {return _name;}
       public function set Name(param_name:String):Void {_name = param_name;}
 
       public function Stuff(){}
}
 
============================
C# Remoting Reception Class:
using System;
namespace Fluorine
{
    public class FlashRemoting
    {
        public string Hello(Stuff s)
        {
            return s.Name;
        }
    }
}
 
============================
C# Custom/Object Class:
using System;
namespace Fluorine
{
    public class Stuff
    {
        private string _name;
        public string Name
        {
            get { return _name; }
            set { _name = value; }
        }
        public Stuff() {}
    }
}
 
============================
Web.config:
<?xml version="1.0"?>
<configuration>
    <appSettings/>
    <connectionStrings/>
    <system.web>
        <compilation debug="true" />
        <authentication mode="Windows" />
      <httpModules>
        <add name="FluorineGateway" type="com.TheSilentGroup.Fluorine.FluorineGateway, com.TheSilentGroup.Fluorine"/>
      </httpModules>
    </system.web>
</configuration>
 
 
The result is: “Success! : null”
 
Some notes here…
Both the AS and C# custom objects reside in the same namespace/package location.
Debugging from the Visual Studio side, the name of the property come thru (both private and public: _name and Name), but the value is null, on both.
 
Now, with Macromedia’s Remoting the C# side would expect the type “ASObject” and use reflection, then convert to the custom object. I’m assuming this is done within Fluorine via the “classMappings.”
 
I’m beginning to think just sending primitives is the way to go, because when I send an object, or strings, the remoting works as documented.
 
(BTW: I’m not using Flex… flash.net.registerClassAlias doesn’t apply here)
 
Please, give this a try, and see if you don’t get the same results I have.
 
Any insight would be very much appreciated… thanks folks
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com


Looking for last minute shopping deals? Find them fast with Yahoo! Search.
_______________________________________________
fluorine mailing list
fluorine@...
http://fluorine.thesilentgroup.com/mailman/listinfo/fluorine_fluorine.thesilentgroup.com

 « Return to Thread: Typed Objects from AS2 to .NET Assembly

LightInTheBox - Buy quality products at wholesale price