views:

926

answers:

4

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?

A: 

This looks like a tough one.

I don't think it is a formation or serialization issue. Maybe something else in your code is writing to the shared object?

Is there any way you can share your source? This would help as I personally don't have enough info to diagnose what is going on w/o seeing the rest of the code :(

Also....

Is there anything else that is writing to or changing this shared object?

Are all my objects created in AS3 or are some in MXML (I have noticed that the Flex compiler does not always do a good job figuring out MXML).

What version of Flash do I have?

If its Flash 10 does the same problem occur in Flash 9?

Does this happen in all browsers and on all platforms?

Andy Webb
A: 

Just a hunch, but, since I installed Flash Player 10, I am seeing lots of errors with Shared Objects when browsing. Could it be related to newly introduced sandbox/security restrictions?

moritzstefaner
+1  A: 

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.

A: 

we have a code that used to work fine with shared-object until i recently upgraded to flash10, then flash seems to stop writing to the cache. are you seeing the similar problem with 10?