Hello!
We are developing a RIA as our final graduation project, using MTASC+ASDT for
developing, and ARP framework.
At certain point on our application, we have one form (ListPersonsForm) that
uses an AMFPHP service to retrieve a "resumed" list of persons (name, id and
photo). When received, we have a loop that attaches PersonItem (a class linked
to a MC on the library) instances on the ListPersonsForm, one for each person,
obviously. At this point, everything is working fine. From here, we have a
design problem.
When the user presses a PersonItem instance we want to call the getPerson
service which retrieves person's detailed data, and we want to refresh the
ViewPersonInDetailForm with the new data.
So, we have:
Application
|-ListPersonsForm
| |-instances of PersonItem
|
|-ViewPersonInDetailForm
and two commands, getResumedListOfPersons and getPerson(id).
PersonItem has it's own onPress handler (to allow it to change background color
when pressed). We also want to dispatch the getPerson event when PersonItem is
pressed, but that means that we would need to add to the Controller one event
listener to each PersonItem instance, which i am sure it is a bad practice.
___1___
So, the first question is: what's the best solution for dispatching getPerson
from PersonItem instances (or elsewhere) when they are pressed?
___2___
The second question is: on ARP framework, commands should use the viewRef to
inform the view that the data as arrived. But it's the ViewPersonInDetailForm
who should receive the data, and, for now (while the above solution isn't
solved), incorrectly, our "viewRef" is the instance of PersonItem who
dispatched the event, who doesn't need the data and shouldn't be aware of the
existence of ViewPersonInDetailForm...
Can you help us proposing best practices for the problem(s) above?
Thanks in advance! :D
João Saleiro
_______________________________________________
osflash mailing list
[email protected]
http://osflash.org/mailman/listinfo/osflash_osflash.org