1 Reply Latest reply on Mar 2, 2009 2:24 PM by Bill3344507298652

    Java objects to Flex

    Bill3344507298652
      Hopefully this is the right forum, if not pleas accept my apologies.

      We need to return dollars and percent type numbers from java back to Flex using the BlazeDS interface.
      When I create a Java test object to return that looks like:
      public class Test2 implements Serializable{
      private String abc = "abc";
      private Date sqlDate;
      private Time sqlTime;
      private Timestamp timestamp;
      private BigDecimal bd;
      private float lFloat;
      private Float bFloat;
      private double lDouble;
      private Double bDouble;

      The constructor fills in values and the java server (JBoss) returns the object back to Flex. The matching flex object looks like:
      [Bindable]
      public class Test2
      {
      public var abc:String;
      public var sqlDate:Date;
      public var sqlTime:Date;
      public var timestamp:Date;
      public var bd:Number;
      public var lFloat:Number;
      public var bFloat:Number;
      public var lDouble:Number;
      public var bDouble:Number;
      } /* Test2*/

      when I print out the returned object using the trace command, I get:

      ReferenceError: Error #1056: Cannot create property BFloat on jdbcTables.businessdelegate.Test2.
      ReferenceError: Error #1056: Cannot create property LFloat on jdbcTables.businessdelegate.Test2.
      ReferenceError: Error #1056: Cannot create property LDouble on jdbcTables.businessdelegate.Test2.
      t2.bd=3.03
      t2.lFloat=NaN
      t2.bFloat=NaN
      t2.lDouble=NaN
      t2.bDouble=NaN

      If I read http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDo cs_Parts&file=00001103.html correctly these fields should be converted properly.

      Am I missing something or is the web page wrong? Is there another kind of Java object can I use to return a floating point number, I really don't like BigDecimal, it's sooo expensive.

      Thanks

      Bill Tims
        • 1. Re: Java objects to Flex
          Bill3344507298652 Level 1

          Ok, I figured out THIS problem. The real issue is the capitalization of the name. If I use an upper case character as the 2nd character, blaze and flex don't see that they are variable, i.e. aBcd as a variable name doesn't work, whereas abcd does work. Since this problem doesn't appear on the PHP side, I'm guessing the problem is on the Blaze side.