Is length being updated correctly?

From: Jim McNamara<mailto:robol...@yahoo.com>
Sent: Monday, June 6, 2022 5:55 AM
To: users@royale.apache.org<mailto: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.

Reply via email to