How to read all data from abstract Shared Object file? (Flash, Actionscript)
what I meen is to get all objects and their properties, is it possible? How to do such thing?开发者_开发问答
- Read the SharedObject. The documentation is a great start.
- Loop through the properties. Depending on how you stored them if they are simple, a for...in loop should do it. If you are storing complex types (like an Object inside and Object, etc.), you need to first check if the object is simple or not. If it is not, you need to loop through its properties.
Luckily, since you've tagged this for flex as well, the ObjectUtils class will be handy for things like checking if an Object isSimple() or inspecting an Object's properties via getClassInfo().
e.g.
//assuming nestedObjectFromSO is a nested object read from a SharedObject
trace(ObjectUtil.getClassInfo(nestedObjectFromSO).properties);
Depending on your structure, you might need to write a recursive function that gets the data from nested objects within your SharedObject.
HTH, George
You can use AIR Shared Object Editor to grab and edit .sol files.
精彩评论