> Secondly I've seen people using the data property and adding the event
> properties to the newly created data property rather than having the
> properties directly in the event class.
> Can I ask why? Surely this just makes codeing harder as when you type
> eventName.
Not if the data property isn't a generic Object, but a typed Object instead
(ValueObject)
Something like this:
package com.v.apt.events {
import com.v.apt.vo.AptVO
import com.adobe.cairngorm.control.CairngormEvent;
public class GetAPTStatusEvent extends CairngormEvent {
public var data:AptVO;
public function GetAPTStatusEvent(type:String, vo:AptVO=null):void {
super(type);
data = vo;
}
}
}
package com.v.apt.vo{
[Bindable]
public class AptVO{
public var id:uint;
public var foo:String;
// etc..
}
}
And you can then use the VO throughout the Application.
var vo:AptVO = new AptVO();
vo.id = 1
vo.foo= "bar";
var evt:GetAPTStatusEvent = new GetAPTStatusEvent(EVENT_TYPE, vo);
// etc..
So instead of making coding harder, it makes it *alot* easier.
You can perform Bindings, store it in model, use it as dataprovider
(ArrayCollection of AptVO's) etc, etc..
regards,
Muzak
----- Original Message -----
From: "Giles Roadnight" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Monday, October 08, 2007 11:56 AM
Subject: Re: [flexcoders] Cairngorm Events - data object
> Sorry - hit send before I meant to!
>
> Hi All
>
> I've not been using the data object in my cairngorm events but have
> been jsut creating properties within the event and populating these in
> the contructor:
>
> package com.v.apt.events
> {
> import com.v.apt.control.Controller;
> import com.adobe.cairngorm.control.CairngormEvent;
>
> public class GetAPTStatusEvent extends CairngormEvent
> {
> public var cred_prep:String;
>
> public function GetAPTStatusEvent(pCred_prep:String) : void
> {
> super( Controller.EVENT_GETAPTSTATUS );
>
> cred_prep = pCred_prep;
> }
> }
> }
>
> for a start is my syntax what I shoudl be doing for the parameter / class
> property. I put p (fopr parameter) in fron of the name to distinguish the
> parameter from the class property. I could do this instead:
>
> public var cred_prep:String;
>
> public function GetAPTStatusEvent(cred_prep:String) : void
> {
> super( Controller.EVENT_GETAPTSTATUS );
>
> this.cred_prep = cred_prep;
> }
> which is best?
>
> Secondly I've seen people using the data property and adding the event
> properties to the newly created data property rather than having the
> properties directly in the event class.
> Can I ask why? Surely this just makes codeing harder as when you type
> eventName. the IDE won't bring up all the availiable properties. Using
> dynamic properties of a data object you (and the compiler) don't know what
> properties an event has.
>
> Thanks
> Giles.
>
--
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/
<*> Your email settings:
Individual Email | Traditional
<*> To change settings online go to:
http://groups.yahoo.com/group/flexcoders/join
(Yahoo! ID required)
<*> To change settings via email:
mailto:[EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]
<*> 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/