Yay, I got something working. I added in a couple actionscript classes
that map to my java classes...somehow. One is as follows:

package
{
        [RemoteClass(alias="test.summary")]

        [Bindable]
        public class Summary {
                public var clientName:String = "";
                public var budget:int;

                public function Summary() {
                }
        }
}

This works, now I can cast the properties that I get in the way you
said. Is this the only way of doing it? And if it is, is there a code
generation tool that will create these .as files automatically?


-Adam

--- In [email protected], "kroghadam" <[EMAIL PROTECTED]> wrote:
>
> Sorry I am really new to flex, I'm not sure what you mean by value
> objects. The three classes I gave are Java Classes that are
> essentially a facade to further backend persistence code.
> 
> I remote directly to the ProjectList.java class and return an array of
> Projects. I cannot do what you suggested in actionscript as I only
> have the java objects that i am remoting to, and cannot reference those.
> I am beginning to think I am doing something seriously wrong as I only
> have one remote object, and am trying to access java objects contained
> in it. Do I need to have some kind of mapping of action script objects
> as well?
> Any articles and tutorials about accessing java objects would be a
> great help to.
> 
> Thanks for your patience,
> 
> Adam
> 
> 
> 
> --- In [email protected], "valdhor" <stevedepp@> wrote:
> >
> > Caveat: I use PHP with WebORB but I have done a lot of C++ in the
past.
> > 
> > So, to get this straight, you have a value object with a property that
> > contains another value object, right? Try...
> > 
> > (project.summary as Summary).budget
> > 
> > or
> > 
> > Summary(project.summary).budget
> > 
> > 
> > 
> > 
> > 
> > 
> > --- In [email protected], "kroghadam" <akrogh@> wrote:
> > >
> > > Perhaps I should provide a little more detail on my problem,
here are
> > > three stripped down java classes I am using,
> > > 
> > > 
> > > public class Project {
> > >   private String name;
> > >   private Summary summary;
> > > 
> > >   public Project(){
> > >   }
> > > 
> > >   ...usual get/set methods
> > > 
> > > }
> > > 
> > > public class Summary {
> > >   private String clientName;
> > >   private int budget;
> > > 
> > >   public Summary(){
> > >   }
> > > 
> > >   ...usual get/set methods
> > > }
> > > 
> > > public ProjectList {
> > >   private ArrayList<Project> projects;
> > > 
> > >   public ProjectList(){
> > >   }
> > > 
> > >   public Project[] getProjects() {
> > >     buildProjects();
> > >     return projects.toArray(new Project[0]);
> > >   }
> > > 
> > >   public void buildProjects() {
> > >     Project project;
> > >     Summary summary;
> > >     projects = new ArrayList<Project>();
> > >     for(int i = 0; i<10;i++) {
> > >       project = new Project();
> > >       project.setName("Name"+i);
> > >       summary = new Summary();
> > >       summary.setBudget(10000);
> > >       summary.setClientName("Client"+i);
> > >       project.setSummary(summary);
> > >       projects.add(projects);
> > >     }
> > > }
> > > 
> > > Within my flex code I use a remote object to the ProjectList and
bind
> > > an ArrayCollection to the return value of getProjects(). I then pass
> > > the Project elements of this array to a component to display its
> > values. 
> > > This is where my problem comes in. I can display the name of the
> > > project fine in the component by just using {project.name} but I
have
> > > no idea how to access my Summary object to get its data. 
> > > I thought I could just do {project.summary.budget} but that doesn't
> > > display anything. 
> > > I really hope someone can help me solve this problem as I'v been
stuck
> > > on it for some time now. 
> > > 
> > > Thanks again,
> > > 
> > > -Adam
> > > --Flex Newbie
> > > 
> > > 
> > > --- In [email protected], "kroghadam" <kroghadam@> wrote:
> > > >
> > > > Hi everybody, I am really enjoying my first look into flex! 
> > > > Unfortunately I have ran into a problem with remote objects to
java
> > > > classes that have compositions of objects in them. In other
words my
> > > > class has an instance variable that is another object whose data i
> > > > also want to access, preferably through the same remote object.
> > > > 
> > > > If anyone has some pointers, links to examples or even source
code I
> > > > would really appreciate it.
> > > > 
> > > > Thanks in advance,
> > > > 
> > > > -Adam
> > > > --Flex Newbie
> > > >
> > >
> >
>


Reply via email to