R – Flash/Flex Error #1063 When Retrieving SharedObject

actionscriptapache-flexflashshared-objects

I have a parts application that is built on Flex 3 and I having a problem with the parts list. The parts list uses two objects:

  • Part
  • ArrayOfPart

I cache the parts list locally in a SharedObject. This has been working fine for a couple months. I added a new Boolean property to the Part class and re-imported web services (which shouldn't have affected anything) and now, I can save the ArrayOfPart SharedObject fine, but when I try to retrieve the SharedObject, I get "ArgumentError: Error #1063: Argument count mismatch on ArrayOfPart. Expected 1, got 0. AND then it DELETES my SOL file completely.

(I used RegisterClass on Part and ArrayOfPart, so they both are serializable to SharedObjects)

Here's the steps I followed to get the error:

Save the shared object:

so = SharedObject.getLocal("PartsList");
so.data.AllParts = AllParts;
so.flush();

Verify the SharedObject:

  • The SharedObject PartsList.sol exists where it should
  • I opened the SharedObject file and the ArrayOfPart data looks valid

Restart the application and it retrieves the parts list from the SharedObject. This is the line that throws the Error #1063 and causes the sol file to be deleted:

so = SharedObject.getLocal("PartsList");

It looks like the data may not be well-formed when it's saved in the SharedObject? Is this possible?

Best Answer

I solved my own problem.

The ArrayOfPart had a constructor with a parameter. When I removed the constructor, the error went away.

By the way, this was Flash 9.

Related Topic