Ok, I do use VO's and have several of them in my code. The compiler still
won't know that the data object is an aptVO - you'll have to cast it each
time. If you just have an aptVO as a property of the event you can just type
eventIntance.voPropertyName.voProperty and the compiler is happy, you get
code completion and you don't need to cast anything to tell teh compiler
that eventInstance.data is an aptVO.

On 10/8/07, Muzak <[EMAIL PROTECTED]> wrote:
>
> > 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
>
>
>
>


-- 
Giles Roadnight
http://giles.roadnight.name

Reply via email to