I don't really understand what you mean by : "PHP won't print it after I return AMF3 encoded binary."
However on the client (Royale) side, the toString method is the same as reading UTF encoded string from the BinaryData instance. The current version of mx.utils.ByteArray is not 'really' any different from org.apache.royale.utils.BinaryData for javascript. If you are expecting AMF3 encoded content then you probably want to decode it (using readObject()) with an org.apache.royale.net.remoting.amf.AMFBinaryData instance. Also, iirc org.apache.royale.net.URLLoader assumes the data result is text. You probably want a URLBinaryLoader instance instead I think, which would give you a org.apache.royale.utils.BinaryData instance from its data getter in the complete handler. if you are then expecting AMF3 content, then probably you could do something similar to what you are doing with 'ByteArray' but substituting AMFBinaryData instead, but you would not be using toString() in that case, you would more likely use readObject(). I am not sure about the endian-ness setting. On Mon, Jun 6, 2022 at 11:03 PM Yishay Weiss <yishayj...@hotmail.com> wrote: > Is length being updated correctly? > > > > *From: *Jim McNamara <robol...@yahoo.com> > *Sent: *Monday, June 6, 2022 5:55 AM > *To: *users@royale.apache.org > *Subject: *reading bytearray from php into actionscript > > > > Hi all- > > I searched the internet for this. > > I can't seem to get a string representation of the binary data passed back > from php_amf3. > > Please glance at the code and let me know if you have a tip. > > thanks for any tips! > jim > > > <fx:Script> > > > > <![CDATA[ > > import org.apache.royale.events.Event; > import mx.events.IOErrorEvent; > import org.apache.royale.net.URLLoader; > import org.apache.royale.net.URLRequest; > import mx.core.IUITextField; > import mx.utils.ByteArray; > import org.apache.royale.utils.BinaryData; > import mx.utils.StringUtil; > import org.apache.royale.utils.Endian; > > public function readData(path:String, callback:Function):void > { > var urlRequest:URLRequest = new URLRequest(path); > var urlLoader:URLLoader = new URLLoader(); > // urlLoader.dataFormat = URLLoaderDataFormat.TEXT; THIS LINE NOT > AVAILABLE FROM ROYALE > urlLoader.addEventListener(Event.COMPLETE, urlLoader_complete); > urlLoader.load(urlRequest); > > var b2:BinaryData = new BinaryData(); > > function urlLoader_complete(evt:Event):void { > > var bytes:ByteArray = new ByteArray(); > > bytes.endian = Endian.LITTLE_ENDIAN; > > var t1:String = new String() ; > bytes.readBinaryData(urlLoader.data as > BinaryData,1,bytes.length); > > // t1= padString(b2.toString(2), 8, "0"); > //t1= b2.toString(); > > > var str:String = bytes.toString(); > input2.text=str; > input3.text=str; > > ..... rest of code that doesn't apply. PHP won't print it after I return > AMF3 encoded binary. > > >