3 Replies Latest reply on Oct 6, 2010 4:58 AM by Tim0W

    Java byte array returning nan

    ryphoenix

      Flex newbie here.  I've spend hours and hours googling but can't figure this out.  I've hit a wall and I'm all out of ideas. > <

       

      I have an existing app that I'm trying to create a thin client by using Flex 3, BlazeDS, Spring, BlzeDS Spring Integration project, running on JBoss 4.2.

       

      I have a DAO that returns me a serializable data object Z, which contains many fields including a byte array: byte[] fileBytes.  I have everything wired up and in the mxml I tried to print the fields of Z, and everything works except the byte array, which is returning me nan/null.  I can't do anything with it, and I've tried.  As far as I can tell, byte[] is supposed to map to ByteArray, and this should work fine.  I'm not sure what I'm doing wrong...any help would be MUCH appreciated!

       

      relevant portions of my mxml:

      ==================================================

          <mx:RemoteObject id="masterRo" destination="masterService">
            <mx:method name="getActiveObject" result="compileObject(event)"/>
          </mx:RemoteObject>

       

          private function loadData():void
          {
            masterRo.getActiveObject();
          }

       

          private function compileObject(event:ResultEvent):void
          {

            Alert.show("name:" + event.result.name + " createdDate:" + event.result.createdDate);  // This works fine!

            Alert.show("bytes:" + event.result.fileBytes);  // NaN

            var bytes:ByteArray = event.result.fileBytes as ByteArray; // TypeError: Error #1009: Cannot access a property or method of a null object reference.
          }

       

      <mx:Button label="Search" click="loadData()"/>

      ==================================================

      java method just queries the DB and returns Z, and I've verified that fileBytes has stuff in it.