Thanks Tim, I like this approach - I wanted to try and stick with the
Cairngorm way rather than start grafting bits on when I couldn't see
how Cairngorm would do it. A definite eye opener for me to have a
Cairngorm event without the attached command! But it makes total sense
... I learned something ... a good day :-)

Mic.


--- In flexcoders@yahoogroups.com, "Tim Hoff" <[EMAIL PROTECTED]> wrote:
>
> 
> For clarity, one addendum: use the CairngormEventDispatcher to dispatch
> your Cairngorm events.
> 
> -TH
> 
> --- In flexcoders@yahoogroups.com, "Tim Hoff" <TimHoff@> wrote:
> >
> > Hi Mic,
> >
> > One way that you can create a solution for your use case is to use
> > Cairngorm events.
> >
> > A common misconception is that all Cairngorm events have to be
> > registered to a command in the FrontController and that they all need
> > to have an custom event class. They don't. In some cases, for
> > simple component communication, you may want to just declare a
> > Cairngorm event in the FrontController, but not register it to a
> > command. This allows any component in the application to listen for
> > the event, and then act accordingly. This is commonly done to avoid
> > bubbling issues with standard Flash/Flex events.
> >
> > So, for your case, you could use the two events that you indicate;
> > except make them Cairngorm events instead of Flash events. Declare
> > them both in the FrontController and register only the signonEvent to
> > a signonCommand. In the sun component dispatch the userLogAttempt
> > event; when the user clicks the button. In the bench component, add
> > an event listener for the userLogAttempt event. Then, in the
> > bench's
> > event listener method, dispatch the signonEvent; with the appropriate
> > VO data attached.
> >
> > Hope that this helps,
> > -TH
> >
> > --- In flexcoders@yahoogroups.com, "chigwell23" chigwell23@ wrote:
> > >
> > > PseudoGUI:
> > >
> > > Screen shows green fields, blue sky, yellow sun and a park bench.
> > > The fields and the sky are the "main" scenery mxml file gui, and
> both
> > > the sun and the park bench are each mxml components loaded with the
> > > standard
> > >
> > > <comp:sun id="sun1"> </comp:sun>
> > > <comp:bench id="bench1"> </comp:bench>
> > >
> > > bench contains the username and password entry fields
> > > sun contains the login button.
> > >
> > > Standard Cairngorm where all components are on same View =
> > >
> > > <mx:Button id="signInButton" label="Sign In" click="{signon(event)}"
> > > ...............
> > > private function signon(e:MouseEvent):void{
> > > var signonEvent:SignonEvent = new SignonEvent( new LoginVO (
> > > username.text, password.text));
> > > signonEvent.dispatch();
> > > }
> > > ...........
> > > However here the entry fields are on one component, the login button
> > > is on another and neither are the "parent".
> > >
> > > Do I dispatch an event from the sun indicating it was clicked:
> > >
> > > <mx:Metadata>
> > > [Event(name="userLogAttempt", type = "flash.events.Event")]
> > > </mx:Metadata>
> > > ..........
> > >
> > > private function signon2(e:MouseEvent):void
> > > ............ {var userLogAttempt:Event = new
> > > Event("userLogAttempt");
> > > this.dispatchEvent(userLogAttempt);
> > > .........
> > > <mx:button id="btnSun" click="{signon2(event)}"/>
> > > ............
> > >
> > > and then trap the sun click event on the scenery parent:
> > >
> > > private function userLogAttempt():void{
> > > Alert.show("Sun clicked = logon attempt"); // should be able to
> > > extract username and password from bench child? Build VO here and
> > > dispatch classic Cairngorm event
> > > ............. }
> > >
> > > <comp:sun id="sun1">
> > > userLogAttempt="userLogAttempt()">
> > > </comp:sun>
> > > .........
> > >
> > > where I should be able to extract the username and password from the
> > > bench child, right? And then dispatch a classic Cairngorm event?
> > >
> > > or is there a 'Cairngorm' way of doing this? TIA,
> > >
> > > Mic.
> > >
> >
>


Reply via email to