What you're saying here works, but you can definitely use
RegisterClassAlias to get strongly typed objects when
storing/retrieving data from a SharedObject or anything else AMF2
based (LocalConnection for example). This would prevent the need to
cast any objects.

--- In flexcoders@yahoogroups.com, "valdhor" <valdhorli...@...> wrote:
>
> I don't think you can do that. A SharedObject is just an object. What
> you would need to do is put the WindowInfo objects you want to store
> into an array and store the array in the SharedObject. When you want
> to retrieve the WindowInfo objects, read them into an array and coerce
> each array item into a WindowInfo object.
> 
> 
> --- In flexcoders@yahoogroups.com, "thelordsince1984" <loreboa@> wrote:
> >
> > Hi,
> > 
> > i've yet posted this question but i can't resolve this problem..
> > 
> > i've created a custom value object class..a simple class with private
> > properties and getters methods to retrieve them.
> > 
> > public class WindowInfo
> >     {       
> >             
> >             private var _id:String;
> >             
> >             private var _module:String
> >             
> >             private var _xpos:int;
> >             
> >             private var _ypos:int;
> >             
> >             private var _width:int;
> >             
> >             private var _height:int;
> >             
> >             public function WindowInfo(id:String, module:String, xpos:int,
> > ypos:int, width:int, height:int)
> >             {
> >                     this._id = id;
> >                     this._module = module;
> >                     this._xpos = xpos;
> >                     this._ypos = ypos;
> >                     this._width = width;
> >                     this._height = height;
> >             }
> >             
> >             public function get id():String {
> >                     return _id;
> >             }
> >             
> >             public function get module():String {
> >                     return _module;
> >             }
> >             
> >             public function get xpos():int {
> >                     return _xpos;
> >             }
> >             
> >             public function get ypos():int {
> >                     return _ypos;
> >             }
> >             
> >             public function get width():int {
> >                     return _width;
> >             }
> >             
> >             public function get height():int {
> >                     return _height;
> >             }
> >     }
> > 
> > then i created an array collection where each item is an istance of
> > value object.
> > then i have a shared object manager that looks like this:
> > 
> > package util{
> > 
> > import flash.net.SharedObject;
> > 
> > import mx.collections.ArrayCollection;
> > 
> > public class SharedObjectApplicationManager {
> > 
> > private var mySO:SharedObject;
> > private var ac:ArrayCollection;
> > private var lsoType:String;
> > 
> > public function SharedObjectApplicationManager(s:String) {
> > init(s);
> > }
> > 
> > private function init(s:String):void {
> > mySO = SharedObject.getLocal(s);
> > if (getf()) {
> > getf();
> > }
> > }
> > 
> > public function getf():ArrayCollection {
> > return mySO.data.arrayc;
> > }
> > 
> > private function adda(array:ArrayCollection):void {
> > mySO.data.arrayc = new ArrayCollection();
> > mySO.data.arrayc = array;
> > mySO.flush();
> > }
> > }
> > }
> > 
> > so when i try to get arraycollection with getf method i get an
> > arraycollection of generic objects…not with windowinfo objects..in
> > this manner i can't get value properties of value object class.
> > 
> > so i would use registerClassAlias("Info", WindowInfo) where WindowInfo
> > is the VO..but where?
> > 
> > the architecture of my app is:
> > 
> > -main application (verify the shared object, if full then call a
> > public function of canvas to create windows with specific parameters
> > saved in windowinfo class)
> > –canvas (contains one or more windows)
> > 
> > any suggestions?
> > 
> > Thanks in advance
> > 
> > Regards Lorenzo
> >
>


Reply via email to