Re: [flexcoders] Re: Cairngorm Events
On Wednesday 26 July 2006 16:56, JesterXL wrote: Not anymore, no, as he's usually embedded at the top of the tree. I'm not sure what you mean. could utilize ViewLocator I guess, but that is bleh. Indeed. We tend to pass the view into the event instead. -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- 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/
Re: [flexcoders] Re: Cairngorm Events
Typically, in my Application, I'll put the Controller. The Application can only capture deeply nested events if they bubble, and unless you utilize classpaths as your event names, you run the danger of name collisions for bubbling events in bigger apps. The Controller can only get events from the CairngormEventDispatcher; he no longer supports the built-in EventDispatcher through the normal display list. So, although he does extend UIComponent, he ignores regular events dispatched up to Application. Could you make it work? Sure, but then that's not the latest way Cairngorm works. I don't mind modding Cairngorm, to be sure, just pointing it out. - Original Message - From: Tom Chiverton [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, July 27, 2006 4:26 AM Subject: Re: [flexcoders] Re: Cairngorm Events On Wednesday 26 July 2006 16:56, JesterXL wrote: Not anymore, no, as he's usually embedded at the top of the tree. I'm not sure what you mean. could utilize ViewLocator I guess, but that is bleh. Indeed. We tend to pass the view into the event instead. -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- 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 -- 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/
Re: [flexcoders] Re: cairngorm Events and data payloads
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 thinkyou just need to check to make sure the event you received is yourcustom 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 flexcoders@yahoogroups.com, Douglas Knudsen[EMAIL PROTECTED] wrote: can someone point me to a example of how to pass data in a cairngormtype 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 ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 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/-- Douglas Knudsenhttp://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 SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
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 thinkyou just need to check to make sure the event you received is yourcustom 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 flexcoders@yahoogroups.com, Douglas Knudsen[EMAIL PROTECTED] wrote: can someone point me to a example of how to pass data in a cairngormtype 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 ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 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/ -- Douglas Knudsenhttp://www.cubicleman.com this is my signature, like it? -- 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 SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Re: cairngorm Events and data payloads
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: flexcoders@yahoogroups.com 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 thinkyou just need to check to make sure the event you received is yourcustom 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 flexcoders@yahoogroups.com, "Douglas Knudsen"[EMAIL PROTECTED] wrote: can someone point me to a example of how to pass data in a cairngormtype 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 ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 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/-- Douglas Knudsenhttp://www.cubicleman.com this is my signature, like it? -- 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 SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
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: flexcoders@yahoogroups.com 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 thinkyou just need to check to make sure the event you received is yourcustom 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 flexcoders@yahoogroups.com, Douglas Knudsen[EMAIL PROTECTED] wrote: can someone point me to a example of how to pass data in a cairngormtype 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 ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 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/-- 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 SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Re: cairngorm Events and data payloads
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: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com 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 thinkyou just need to check to make sure the event you received is yourcustom 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 flexcoders@yahoogroups.com, "Douglas Knudsen"[EMAIL PROTECTED] wrote: can someone point me to a example of how to pass data in a cairngormtype 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 ListFAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txtSearch Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.comYahoo! 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/-- Douglas Knudsenhttp://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 SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit yo
Re: [flexcoders] Re: cairngorm Events and data payloads
My initial frustration was I'd create this event class, which allowed strong-typing, like so: package { import com.adobe.control.CairngormEvent; public class MyEvent extends CairngormEvent { public static const ACTION:String = action; public var someID:int; public function MyEvent(p_type:String, p_someID:int) { super(p_type); someID = p_someID; } } } So, my event now has context. If I need to have my Command get a person record from the DB for example, this event will contain the payload it needs; the person ID I'm looking for. However, by the time it gets to the Command, it's a base class, the CairngormEvent. package { public class MyCommand implements AllTheInterfacesEct { public function execute ( event:CairngormEvent ) { trace(event.someID); // faith based programming } } } Now, for some, their Events are directly linked to Commands, like so: LoginEvent will fire LoginCommand which calls LoginDelegate GetPersonEvent will fire GetPersonCommand which calls GetPersonDelegate At a simple level, yes, this'll do. So, you can acutally make some assumptions in the above; if you play by the default Cairngorm rules, you KNOW by convention that your MyCommand class will get a MyEvent, so you could risk up-casting, like so: someDelegateMethod ( MyEvent ( event ) . someID ); ...that's faith, though. You'll get an exception if for some reason that's not the real event. It'd be better if the compiler caught that vs. the runtime, before it's a problem. For me, I use multiple events inside Commands, so it's exacerbated. The Controller keeps all of this under tabs, but again, it'd be nice if MyCommand for example GOT MyEvent in the execute. I supposed you could make that assumption; not sure if it'd compile. Anyway, convention over strict-typing is ok since a lot of conventions teams follow can do the above, for example, and assume you'll get what you need. - Original Message - From: ben.clinkinbeard [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, July 27, 2006 10:22 PM Subject: [flexcoders] Re: cairngorm Events and data payloads 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 flexcoders@yahoogroups.com, 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: flexcoders@yahoogroups.com 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: flexcoders@yahoogroups.com 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 flexcoders
Re: [flexcoders] Re: cairngorm Events and data payloads
5 coffee's and 3 RedBull's later, I'm running on fumes, so don't really have intelligent answers for you, just guesses. Don't know, I guess you're right. Find some way to either A) follow the convention a Command will get the event class of a similiar name, and thus feel safe in casting it or B ) find some way to strongly type that parameter. You can't up-cast function arguments, though, so it's kind of stuck as CairngormEvent... I think. For the multiple events, yes, you are correct. I've definately taken for granted all my other stuff has worked for that very fact. Oops. Actually, at this point, no clue... wtf were you talking about anyway, Bokel? - Original Message - From: ben.clinkinbeard [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, July 27, 2006 10:50 PM Subject: [flexcoders] Re: cairngorm Events and data payloads Doesn't execute() accept a CairngromEvent for the sake of polymorphism though? How could you do things any differently and still preserve that aspect? Additionally, if you want your Commands to support multiple types of events isn't it essential that execute() accept a superclass or common interface? Are you just wishing AS supported method overloading or is there something I am still not getting? Thanks, Ben http://www.returnundefined.com/ --- In flexcoders@yahoogroups.com, JesterXL [EMAIL PROTECTED] wrote: My initial frustration was I'd create this event class, which allowed strong-typing, like so: package { import com.adobe.control.CairngormEvent; public class MyEvent extends CairngormEvent { public static const ACTION:String = action; public var someID:int; public function MyEvent(p_type:String, p_someID:int) { super(p_type); someID = p_someID; } } } So, my event now has context. If I need to have my Command get a person record from the DB for example, this event will contain the payload it needs; the person ID I'm looking for. However, by the time it gets to the Command, it's a base class, the CairngormEvent. package { public class MyCommand implements AllTheInterfacesEct { public function execute ( event:CairngormEvent ) { trace(event.someID); // faith based programming } } } Now, for some, their Events are directly linked to Commands, like so: LoginEvent will fire LoginCommand which calls LoginDelegate GetPersonEvent will fire GetPersonCommand which calls GetPersonDelegate At a simple level, yes, this'll do. So, you can acutally make some assumptions in the above; if you play by the default Cairngorm rules, you KNOW by convention that your MyCommand class will get a MyEvent, so you could risk up-casting, like so: someDelegateMethod ( MyEvent ( event ) . someID ); ...that's faith, though. You'll get an exception if for some reason that's not the real event. It'd be better if the compiler caught that vs. the runtime, before it's a problem. For me, I use multiple events inside Commands, so it's exacerbated. The Controller keeps all of this under tabs, but again, it'd be nice if MyCommand for example GOT MyEvent in the execute. I supposed you could make that assumption; not sure if it'd compile. Anyway, convention over strict-typing is ok since a lot of conventions teams follow can do the above, for example, and assume you'll get what you need. - Original Message - From: ben.clinkinbeard [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Thursday, July 27, 2006 10:22 PM Subject: [flexcoders] Re: cairngorm Events and data payloads 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 flexcoders@yahoogroups.com, JesterXL jesterxl@ 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: flexcoders@yahoogroups.com 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
Re: [flexcoders] Re: Cairngorm Events
Thanks guys, I know the usual method for Cairngorm events, and I'm using that as well, but in this case I'm doing some random voodo magic with dynamically generated components and I was hoping I could set an event listener for each of those components to capture an associated CairngormEvent. It doesn't sound like I can do that.Thanks again,Ryan-Original Message-From: [EMAIL PROTECTED]Sent: Wednesday, July 26, 2006 9:22 AM -07:00To: flexcoders@yahoogroups.comSubject: [flexcoders] Re: Cairngorm EventsAs Tom says, usually a Carirngorm event is dispatched to the FrontController, which in turn executes an instance of a command. And ultimatly, the ModelLocator gets updated and the view reacts via binding. Presently however, there isn't a mechanism to listen, for the result of the dispatched Cairngorm event, from the view.Hoping to change that. Your question is valid and appropriate.-TH--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Wednesday 26 July 2006 07:07, Ryan Stewart wrote: I'm still not entirely clear on the event model in Flex 2, so hopefully this is an easy question. I want to add an event listener in one of my flex view components that will listen for a CairngormEvent to be dispatched and then run a function within that component. Cairngorm would normally say that if you want something to happen when an Event is dispatched, you put that code in the Controller associated with the Event. -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Re: Cairngorm Events
If you use dispatchEvent, yes. If you use CairngormEventDispatcher, no. - Original Message - From: Ryan Stewart To: flexcoders@yahoogroups.com Sent: Wednesday, July 26, 2006 11:27 AM Subject: Re: [flexcoders] Re: Cairngorm Events Thanks guys, I know the usual method for Cairngorm events, and I'm using that as well, but in this case I'm doing some random voodo magic with dynamically generated components and I was hoping I could set an event listener for each of those components to capture an associated CairngormEvent. It doesn't sound like I can do that. Thanks again, Ryan -Original Message- From: [EMAIL PROTECTED] Sent: Wednesday, July 26, 2006 9:22 AM -07:00 To: flexcoders@yahoogroups.com Subject: [flexcoders] Re: Cairngorm Events As Tom says, usually a Carirngorm event is dispatched to the FrontController, which in turn executes an instance of a command. And ultimatly, the ModelLocator gets updated and the view reacts via binding. Presently however, there isn't a mechanism to listen, for the result of the dispatched Cairngorm event, from the view. Hoping to change that. Your question is valid and appropriate. -TH --- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Wednesday 26 July 2006 07:07, Ryan Stewart wrote: I'm still not entirely clear on the event model in Flex 2, so hopefully this is an easy question. I want to add an event listener in one of my flex view components that will listen ! for a CairngormEvent to be dispatched and then run a function within that component. Cairngorm would normally say that if you want something to happen when an Event is dispatched, you put that code in the Controller associated with the Event. -- Tom Chiverton This emai! l is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered! office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. I! f you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. ! For more information about Halliwells LLP visit www.halliwells.com. __._,_.___ -- 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 Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Re: Cairngorm Events
I figure that's what I have to do, just create a custom event and dispatch the event in the onResult method.Thanks again all,Ryan-Original Message-From: [EMAIL PROTECTED]Sent: Wednesday, July 26, 2006 3:35 PM -07:00To: flexcoders@yahoogroups.comSubject: [flexcoders] Re: Cairngorm EventsIf you use dispatchEvent, yes. If you use CairngormEventDispatcher, no.- Original Message - From: Ryan Stewart To: flexcoders@yahoogroups.com Sent: Wednesday, July 26, 2006 11:27 AMSubject: Re: [flexcoders] Re: Cairngorm EventsThanks guys, I know the usual method for Cairngorm events, and I'm using that as well, but in this case I'm doing some random voodo magic with dynamically generated components and I was hoping I could set an event listener for each of those components to capture an associated CairngormEvent. It doesn't sound like I can do that.Thanks again,Ryan-Original Message-From: [EMAIL PROTECTED]Sent: Wednesday, July 26, 2006 9:22 AM -07:00To: flexcoders@yahoogroups.comSubject: [flexcoders] Re: Cairngorm EventsAs Tom says, usually a Carirngorm event is dispatched to the FrontController, which in turn executes an instance of a command. And ultimatly, the ModelLocator gets updated and the view reacts via binding. Presently however, there isn't a mechanism to listen, for the result of the dispatched Cairngorm event, from the view.Hoping to change that. Your question is valid and appropriate.-TH--- In flexcoders@yahoogroups.com, Tom Chiverton [EMAIL PROTECTED] wrote: On Wednesday 26 July 2006 07:07, Ryan Stewart wrote: I'm still not entirely clear on the event model in Flex 2, so hopefully this is an easy question. I want to add an event listener in one of my flex view components that will listen ! for a CairngormEvent to be dispatched and then run a function within that component. Cairngorm would normally say that if you want something to happen when an Event is dispatched, you put that code in the Controller associated with the Event. -- Tom Chiverton This emai! l is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered! office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. I! f you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008.! For more information about Halliwells LLP visit www.halliwells.com. __._,_.___ -- Flexcoders Mailing List FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com SPONSORED LINKS Web site design development Computer software development Software design and development Macromedia flex Software development best practice YAHOO! GROUPS LINKS Visit your group "flexcoders" on the web. To unsubscribe from this group, send an email to:[EMAIL PROTECTED] Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. __,_._,___
Re: [flexcoders] Re: Cairngorm Events
On Wednesday 26 July 2006 16:35, JesterXL wrote: If you use dispatchEvent, yes. If you use CairngormEventDispatcher, no. For more information about Halliwells LLP visit www.halliwells.com. Though couldn't the Controller dispatchEvent() for the components to listen too ? -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. Yahoo! Groups Sponsor ~-- Yahoo! Groups gets a make over. See the new email design. http://us.click.yahoo.com/WktRrD/lOaOAA/yQLSAA/nhFolB/TM ~- -- 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/
Re: [flexcoders] Re: Cairngorm Events
Not anymore, no, as he's usually embedded at the top of the tree. You could utilize ViewLocator I guess, but that is bleh. - Original Message - From: Tom Chiverton [EMAIL PROTECTED] To: flexcoders@yahoogroups.com Sent: Wednesday, July 26, 2006 11:46 AM Subject: Re: [flexcoders] Re: Cairngorm Events On Wednesday 26 July 2006 16:35, JesterXL wrote: If you use dispatchEvent, yes. If you use CairngormEventDispatcher, no. For more information about Halliwells LLP visit www.halliwells.com. Though couldn't the Controller dispatchEvent() for the components to listen too ? -- Tom Chiverton This email is sent for and on behalf of Halliwells LLP. Halliwells LLP is a limited liability partnership registered in England and Wales under registered number OC307980 whose registered office address is at St James's Court Brown Street Manchester M2 2JF. A list of members is available for inspection at the registered office. Any reference to a partner in relation to Halliwells LLP means a member of Halliwells LLP. Regulated by the Law Society. CONFIDENTIALITY This email is intended only for the use of the addressee named above and may be confidential or legally privileged. If you are not the addressee you must not read it and must not use any information contained in nor copy it nor inform any person other than Halliwells LLP or the addressee of its existence or contents. If you have received this email in error please delete it and notify Halliwells LLP IT Department on 0870 365 8008. For more information about Halliwells LLP visit www.halliwells.com. -- 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 Yahoo! Groups Sponsor ~-- Yahoo! Groups gets a make over. See the new email design. http://us.click.yahoo.com/WktRrD/lOaOAA/yQLSAA/nhFolB/TM ~- -- 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/