Expand my Community achievements bar.

Accessing RemoteObject results

Avatar

Level 2

I have a RemoteObject which returns an array which I can bind to a datagrid.

1.)  However, how can/do I access an element of the array to say populate a Label?  I've tried every combination of syntax/processing I can think of, both directly using lastResult as well as via a function but no joy so far . . .

2.) If I'm returning a set of "page components" should I create an AS3 class/VO and assign the returned array values to it (and if so how)?

3.) If I want to save said VO as a storedObject . . . .

4.) How can I use the above element to say populate an image control where source="http:www.mysite/images/{element}.jpg"

Sorry if this covers many issues but I'm trying to take  baby steps

5 Replies

Avatar

Level 2

K, so accessing the results seems to require a reference to the array such as:

myData.getItemAt(0).database_column_name    OR        text="{myData[0].nickname}"    

Also, image addressing can be achieved through concatenating the aforementioned results with the static text such as:


picture1.source = myData.getItemAt(0).ImageServer + '/noleech.gif';

Any help with the ValueObject and StoredObject issues would still be appreciated though (ie. why/when to create VO and/or how to assign to a StoredObj?)

Avatar

Level 3

What server technology are you using?

Avatar

Level 2

cf8 on windows server 2003 with IIS connecting to a MySql database

Avatar

Level 3

Definitively VO will be the way to go in your case, if you have Flex Builder you can use the CF wizards to create VOs.

Avatar

Level 2

To be perhaps more specific:

1.  Should arrays returned to flex be (generally in medium-large apps) converted to a "ValueObject".  Is there any guidelines when a VO is needed/desirable?

1.b.  Cairngorm etc aside, just for getting started/learning purposes is process as follows inaccurate:    RemoteObject data (say image_filenames.jpg) received >>>> to ValueObject >>>> to StoredObject >>>> accessed by (say) tileList component   ????

2.  Is the "Model Object" pattern outlined here: http://blog.tsclausing.com/post/24  good practice to use whenever creating/modifying a VO?? (i.e. does data received directly from the server need to be passed through as a safeguard?)

3. The relational java objects discussed here: http://blog.olivermerk.ca/index.cfm/2007/6/1/Flex-Converting-ObjectProxies-to-Value-Objects     and elsewhere I assume refer to Java Server Pages  -- which (and correct me if I am wrong) "reside" on a java based webserver (like say tomcat?) and allow said webserver to interact directly with the database.

4.  Following on 3., my "learning curve" went through DW3 >>> CF8 >>> Flex    so I know this is probably waay reaching but how does JSP performance compare to CFusion (which I know is Java based but still seems like an intermediary step to me).  Moreover, I know CF has benefits like data modelling that offset the cost but can anyone comment in light of the extent to which Flex/client-side code alters a "conventional" MVC architecture (ie.  MVC is easy to "understand" if you say Model=database, View=HTML, Controller=Coldfusion/PHP   but if you store and process data client side then at least some Model and Controller is duplicated/dispersed to a "AS3 View")

Thanks in advance,