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.
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 RamosItacon CorporationTechnology 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 RamosItacon CorporationTechnology Manager
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.