Forgive the dense noob here, but how is the type info lost? I thought that by subclassing CairngormEvent you get basic checking and then you can just do a cast or 'event as MyCutomEvent' inside the execute method. I guess I am just not clear on what the issue is and where the problem lies. Can someone edumacate me?
Thanks, Ben http://www.returnundefined.com/ --- In [email protected], "JesterXL" <[EMAIL PROTECTED]> wrote: > > Well, my events extend CairngormEvent, so I can technically upcast 'em when they get in the Command's execute method. I know Steven didn't really dig this idea, but if you case the type, you can compare to the Event's constant like: > > public static const EVENT_DOSOMETHING:String = "doSomething"; > > function execute(event:CairngormEvent) > { > switch(event.type) > { > case MyEvent.EVENT_DOSOMETHING: > someMethod ( MyEvent(event).someTypeSafeProp); > break; > } > } > > > ----- Original Message ----- > From: Ralf Bokelberg > To: [email protected] > Sent: Thursday, July 27, 2006 4:20 PM > Subject: Re: [flexcoders] Re: cairngorm Events and data payloads > > > The only typesafe solution i can think of, is to abandon CairngormEvents and replace them by methods of the FrontController. Most of the apps i've seen so far don't make use of the runtime changeability anyways. What do we loose if we do it like that? > > Cheers, > Ralf. > > > On 7/27/06, JesterXL <[EMAIL PROTECTED]> wrote: > I'm with you. I've been determing type of event based on the event.type in the Command's execute method to get my strong-typing back. > > ----- Original Message ----- > From: Ralf Bokelberg > To: [email protected] > Sent: Thursday, July 27, 2006 12:58 PM > Subject: Re: [flexcoders] Re: cairngorm Events and data payloads > > > Its really a pity, that we loose all the nice type information while going all the way through Cairngorm. > > Cheers, > Ralf. > > > On 7/27/06, Douglas Knudsen <[EMAIL PROTECTED]> wrote: > ah, righto. thanks d00ds. I had this hacked up too much...no worky good. If only I can get that damn RO to calm down now and do what its told! but that's another thread. > > > DK > > > > On 7/27/06, thunderstumpgesatwork < [EMAIL PROTECTED]> wrote: > Hi, > > The delegate function thinks you just have a CairngormEvent. I think > you just need to check to make sure the event you received is your > custom event type and then cast it. > > so: > > if (eventHere is LoadScorecardEvent) > { > del.getScorecard( LoadScorecardEvent(eventHere).scorecardId ); > } > else > { > // do nothing, or raise error, or log warning, or whatever. > } > > > best of luck, > Thunder > > --- In [email protected], "Douglas Knudsen" > <douglasknudsen@> wrote: > > > > can someone point me to a example of how to pass data in a cairngorm > type > > event? I'm trying the below with > > > > package com.mycompany.events > > { > > import com.adobe.cairngorm.control.CairngormEvent; > > > > public class LoadScorecardEvent extends CairngormEvent > > { > > public static var EVENT_LOAD_SCORECARD: String = > > 'LoadScorecardEvent'; > > public var scorecardId:Number; > > /** > > * The constructor, > > */ > > public function LoadScorecardEvent( ) > > { > > super( EVENT_LOAD_SCORECARD ); > > > > } > > > > } > > > > } > > > > then in a view dispatching like so > > var devent : LoadScorecardEvent = new LoadScorecardEvent( ); > > devent.scorecardId = 5; > > > CairngormEventDispatcher.getInstance().dispatchEvent( > > devent ); > > > > and in the command I have > > > > public function execute( eventHere : CairngormEvent ) : void > > { > > var del : MainDelegate = new MainDelegate( this ); > > del.getScorecard( eventHere.scorecardId ); > > > > } > > > > But this bombs out with a error about scorecardId not in eventHere. > > > > DK > > > > > > -- > > Douglas Knudsen > > http://www.cubicleman.com > > this is my signature, like it? > > > > > > > > > > -- > Flexcoders Mailing List > FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt > Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com > Yahoo! Groups Links > > > > > > > > > > > > -- > Douglas Knudsen > http://www.cubicleman.com > this is my signature, like it? > > > > > -- > Ralf Bokelberg <[EMAIL PROTECTED]> > > Flex & Flash Consultant based in Cologne/Germany > > > > -- > Ralf Bokelberg <[EMAIL PROTECTED]> > Flex & Flash Consultant based in Cologne/Germany > -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 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: http://docs.yahoo.com/info/terms/

