0 Replies Latest reply on Oct 18, 2010 4:17 AM by EricJ32

    Possible? Set a child property from remote class

    EricJ32

      Hi,

       

      I have a .NET class which has a decimal property, Value:

       

      public class MyClass

      {

           public string name { get; set; }

           public decimal amount { get; set; }

      }

       

      Then, in Flex, a class which maps to this using [RemoteClass]:

       

      [RemoteClass(alias="MyProject.MyClass")]

      public class MyFlexClass

      {

           public var name:String;

           public var amount:ExtendedNumber = new ExtendedNumber("Value of object");

      }

       

       

      The class ExtendedNumber has all sorts of other methods, such as determining output formatting, allowing pending/live values to be held etc etc. Here is a simplified version:

       

      public class ExtendedNumber

      {

           public var value:Object;

           public var label:String;

       

           public function ExtendedNumber(label:String, value:Object=null)

           {

                this.label = label;

                this.value = value;

           }

      }

       

      Now, obviously when I get data from my .NET class, the amount property of MyFlexClass is null, because it can't convert between a decimal and an ExtendedNumber. Is it possible to convert between one datatype and another during the injection? Or set the child "value" property directly, so I can set the label etc in the constructor?

       

      Thanks for any input.