Hey everyone (especially Adobe engineers), I think I've found a bug with 
ActionScript 3.0's URLStream.readObject() method while trying to read 
some legacy AMF0 files that I have lying around from a previous AS2 project.

To set the stage, I have a bunch of AMF0 streams that were generated 
from Flash Player 8 and saved to files via Flash Remoting and a little 
bit of custom server-side magic (http://www.radicalconcepts.com).

Today, I tried reading some of these files directly into a Flash Player 
9 SWF locally via URLStream rather than the traditional approach of 
using Flash Remoting.  So, running locally within the standalone debug 
player, I read in one of my AMF files and then called readObject() on 
it, only to have the method read a single byte and return a boolean 
true, even though my AMF file actually contained an object.  The 
contents of the file was confirmed through inspecting the file with a 
hex editor with the AMF0 specifications in hand.  Well, Edwin van 
Rijkom's unofficial version, as I don't recall an official spec from 
Macromedia (http://www.vanrijkom.org/archives/2005/06/amf_format.html).

I have the objectEncoding property set to AMF0, and I'm not attempting 
to deserialize until the stream has finished loading.  Inspecting the 
bytes individually via URLStream's readByte() method also confirms that 
the bytes are indeed correct and match up with what's seen in my hex 
editor.  As far as I can tell from the documentation, I'm doing things 
correctly.

Trying a handful of other AMF files yielded the same result.  However, 
if I copy all of the bytes out of the URLStream instance and into a 
ByteArray instance and call it's readObject() method instead, the AMF0 
encoded object deserializes just fine.

I've a simple test case here:

   http://dev.psalterego.com/ReadObjectTest.zip

The example AMF0 file is named test.amf and is located in the /bin 
folder.  You'll need to compile the enclosed MXML file and then run the 
SWF locally using the debug player--the trace outputs should be fairly 
self-explanatory.

If you can spare the time, I'd very much appreciate it if some others 
can verify this so I can be sure that I'm not smoking the crack rock.

Thanks,

Jim Cheng
effectiveUI


--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/flexcoders/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http://groups.yahoo.com/group/flexcoders/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:[EMAIL PROTECTED] 
    mailto:[EMAIL PROTECTED]

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 

Reply via email to