Hey ibo,
 
A map can not be converted to an ArrayCollection (
http://livedocs.adobe.com/flex/2/docs/wwhelp/wwhimpl/common/html/wwhelp.
htm?context=LiveDocs_Parts&file=00001103.html )
 
A map will be converted to an Generic Object, and the key will be a
property:
 
public class LookupData {     
        [ArrayElementType("package.ClassA")]
        public var attributeA:ArrayCollection;
        [ArrayElementType("package.ClassB")]
        public var attributeB:ArrayCollection;
        public var attribute1:Object;
        public var attribute2:Object;
        public var attribute3:Object;
    }

You may access those properties with "attribute1.key1",
"attribute1.key2", "attribute1.anotherKey", ...
 
And in that case, remember to import the value classes.
 

________________________________

De: [email protected] [mailto:[EMAIL PROTECTED] Em
nome de ibo
Enviada em: quinta-feira, 8 de maio de 2008 17:03
Para: [email protected]
Assunto: Re: RES: [flexcoders] value object binding problem



Luciano,

Thanks it worked for List<ClassX> but not for Map<String, List<ClassB>>.
How do we convert this map to AS3?

Luciano Manerich Junior <[EMAIL PROTECTED]> wrote: 

        You MUST import the classes used into the ArrayCollection.
         
        Or, you may use the ArrayElementType, for the auto-import at the
compiler time.
         
         
        public class LookupData {     
                [ArrayElementType("package.ClassA")]
                public var attributeA:ArrayCollection;
                [ArrayElementType("package.ClassB")]
                public var attributeB:ArrayCollection;
                [ArrayElementType("package.ClassB") ] 
                public var attribute1:ArrayCollection;
                [ArrayElementType("package.ClassC")]
                public var attribute2:ArrayCollection;
                [ArrayElementType("package.ClassD")]
                public var attribute3:ArrayCollection;
            }
        
         

________________________________

        De: [email protected] [
mailto:[EMAIL PROTECTED] Em nome de ibo
        Enviada em: quinta-feira, 8 de maio de 2008 14:51
        Para: [email protected]
        Assunto: [flexcoders] value object binding problem
        
        
        I have this VO binding from java to as3:
        
        ------------------------
        JAVA / JDK6 - LookupStuff.java
        
        public class LookupStuff {
            private List<ClassA> attributeA;
            private List<ClassA> attributeB;  
            private Map<String, List<ClassB>> attribute1;
            private Map<String, List<ClassC>> attribute2;
            private Map<String, List<ClassD>> attribute3;
            
            ...setter/getters...
        }    
        
        -------------------------
        AS3 - LookupStuff.as
        
            [RemoteClass(alias="my.java.package.LookupStuff")]    
            import mx.collections.ArrayCollection;
                
            [Bindable]    
        &nbs p;   public class LookupData {        
                public var attributeA:ArrayCollection;
                public var attributeB:ArrayCollection;
                public var attribute1:ArrayCollection;
                public var attribute2:ArrayCollection;
                public var attribute3:ArrayCollection;
            }
        ----------------------------------
                private function myHandler(event:ResultEvent):void {
                    var lookup:LookupStuff = event.result as
LookupStuff;
                    // lookup is null! why???
                }
        ----------------------------
        Im getting null when my actionscript handler (thru RemoteObject
/ ResultEvent) finally gets event.result. Anybody knows why? Can a Map<>
and List<> interfaces easily maps to an AS3 ArrayCollection?
        
        I've verified that my java code is returning a good return value
(not null).
        
        
        
________________________________

        Be a better friend, newshound, and know-it-all with Yahoo!
Mobile. Try it now.
<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i6
2sR8HDtDypao8Wcj9tAcJ%20>  


________________________________

Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try
it now.
<http://us.rd.yahoo.com/evt=51733/*http://mobile.yahoo.com/;_ylt=Ahu06i6
2sR8HDtDypao8Wcj9tAcJ>  

 

Reply via email to