Title: Message
That is 'keeping the interdepancy between my view files as few as possible'.
-----Original Message-----
From: Ben Elmore [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 4:07 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Cairngorm Question.

Well. My thought is 'Who would know what child needed the work done?' The view locator's need to have the view helper name be unique is so that it can locate the view. A command has to be 100% sure what view to work with to get the data to properly make the call out to the server. Therefore my thought is that the safer bet would be to have the command talk to the parent to either a) get the data or b) get the name of the child.
 
Anyway, those are just my thoughts to why I would approach the situation the way I outlined. My judgment of clean has a lot to do with the ability to maintain the application and as much as possible keeping the interdepancy between my view files as possible. Loose coupling.
 
Ben
 
 
-----Original Message-----
From: Omar Ramos [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 3:18 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Cairngorm Question.

Yes I had tho of that idea ben. But was wondering what was the clean way to do it. Thanks for the reply's so far.
 
Omar Ramos
Itacon Corporation
Technology Manager


From: Ben Elmore [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 2:17 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Cairngorm Question.

The way Cairngorm current architects the ViewHelper is that it requires each ViewHelper to register itself to the ViewLocator under a unique name. Therefore if you are attaching the view dynamically in a repeater and using the same value in the 'name' attribute for the ViewHelpers then the ViewLoactor will throw an error.
 
One approach to your solution is to have the each of your views bubble up its methods to the parent view that the repeater exists in.
 
For example (in code babble).
 
MyMainView.mxml
 
<mx:script>
    public activeChild : MovieClip = null;
 
    function parentHandleMethod(evt)
    {
        // store current child view to local var
        activeChild = evt.target'
 
         // do server call
 
    }
</ms:script
....
<mx:repeater>
    <me:mychildView >
</mx:repeater>
...
 
MyChildView.mxml
 
<mx:Metadata>
    [Event("onCustomEvent1")]
    [Event("onCustomEvent2")]
</mx:Metadata>
 
 
<mx:Button click="this.dispatchEvent({type='onCustomEvent1', otherAttributes=''})">
 
 
In this example instead of having the child view handle the logic itself (communicating to the server) it tells the parent too. Or more correctly says 'someone please do this for me' the parent will know which of the child views to get the data from since the dispatch event automatically keeps track of the target in which the event was dispatch from.
 
This is just a suggestion. There are other options out there, perhaps better or more correct then this approach.
 
Ben
 
 
-----Original Message-----
From: Omar Ramos [mailto:[EMAIL PROTECTED]
Sent: Thursday, March 31, 2005 12:53 PM
To: flexcoders@yahoogroups.com
Subject: RE: [flexcoders] Cairngorm Question.

Anyone?
 
Omar Ramos
Itacon Corporation
Technology Manager


From: Omar Ramos [mailto:[EMAIL PROTECTED]
Sent: Wednesday, March 30, 2005 8:18 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Cairngorm Question.

Hi all,
 
I am using the Cairngorm plataform but had a small question. How can I use the viewhelper technique when I attach view dynamicaly? For example I have a mxml component and put a view helper attached to it and use this component on a repeater and 5 instances are made. When I call the getViewHelper method which of those 5 reference will it give me? Any help would be apreaciated.
 
 
 
Omar Ramos
Itacon Corporation
Technology Manager





Yahoo! Groups Links

Reply via email to