mikechambers / as3corelib

An ActionScript 3 Library that contains a number of classes and utilities for working with ActionScript? 3. These include classes for MD5 and SHA 1 hashing, Image encoders, and JSON serialization as well as general String, Number and Date APIs.
1.49k stars 448 forks source link

JSONEncoder.objectToString() fails when the object has "internal" property #183

Open demauk opened 12 years ago

demauk commented 12 years ago

An object o can have an internal public var myvar variable, and v:XML = classInfo.variable will correctly report it as a public variable, but o[ v.@name ] will fail because the variable is not available to us.

This can be fixed in a similar way to the check for Transient metadata. An internal variable or accessor with have a uri attribute set to "http://www.adobe.com/2006/flex/mx/internal":

// If property is declared as internal, skip it
if ( v.@uri != '' && String(v.@uri).indexOf( "internal" ) != -1 )
{
  continue;
}

I've implemented this on my fork: https://github.com/demauk/as3corelib/blob/master/src/com/adobe/serialization/json/JSONEncoder.as#L536