BTW, If you guys test my example doen't show any error. But is not complete. Let me show you some code:
My Class: package { [Bindable] [RemoteClass(alias='MyClass')] public class MyClass { public function MyClass(mystring:String) { } } } Save and open: private function onInit():void{ var arr:ArrayCollection = new ArrayCollection (); var obj1:MyClass = new MyClass('uno'); var obj2:MyClass = new MyClass('dos'); var obj3:MyClass = new MyClass('tres'); arr.addItem(obj1); arr.addItem(obj2); arr.addItem(obj3); var file:File = File.applicationStorageDirectory.resolvePath('test.data'); var stream:FileStream = new FileStream(); stream.open(file, FileMode.WRITE); stream.writeObject(arr); stream.close(); //Saves an AC var streamR:FileStream = new FileStream(); streamR.open(file, FileMode.READ); var arrnew:ArrayCollection = new ArrayCollection(); while(streamR.bytesAvailable){ arrnew = streamR.readObject() as ArrayCollection; //ERROR trace(arrnew); } streamR.close(); } The problem is using the [RemoteClass(alias='MyClass')] to register the class. If I dont use the tag in the class declaration, my example works ok. Any idea? Could be a bug? Do I need to specify any other parameter in the RemoteClass tag? TIA _____________________________________________ Claudio M. E. Bastos Iorio http://www.blumer.com.ar <http://www.blumer.com.ar> --- In flexcoders@yahoogroups.com, "Claudio M. E. Bastos Iorio" <[EMAIL PROTECTED]> wrote: > > > Hi, I'm using AMF format storing and retrieving objects using write and > readobject() in AIR. > > But I have a problem. Let's say this is my class: (simple, no params in > constructor) > > ActionScript Code: > public class MyClass { > > public function MyClass():void { > > } > > } > > Then, I create an ArrayCollection (and save the arraycollection object > to the file) with instances of this class. This is working ok, I can > save, open and retrieve, iterate objects in the stored arraycollection > just fine. > > BUT, if my class have any parameter in the constructor, my code fails > retrieving the arraycollection > > Something like this: > > ActionScript Code: > var file:File = File.applicationDirectory.resolvePath('Data.data'); > var stream:FileStream = new FileStream(); > stream.open(file, FileMode.READ); > var myAC:ArrayCollection = new ArrayCollection(); > while(stream.bytesAvailable){ > myAC = stream.readObject() as ArrayCollection;//ERROR Error #1063: > Argument count mismatch > } > > Any idea ..? > > TIA >