code: public IoBuffer encodeFlexMessage(FlexMessage msg) {
          IoBuffer out = IoBuffer.allocate(1024);
          out.setAutoExpand(true);
          // Unknown byte, always 0?
          out.put((byte) 0);
          encodeCommand(out, msg);
          return out;
      }
docs: Encodes Flex message event.
  
  @param msg
  Flex message event
  @return Encoded data