A generic object has no meaning, you lose typecasting and all the benefits of using a custom class, like for example, code completion.
Remember anonymous functions in AS1/2 and why they were bad? It's not quite as bad to use generic objects, but still not good practice IMO. With VOs, you know what properties it contains, and that's very useful in situations, like for example, when you attach data to an event and want to use it on the other end. Believe me, VOs are worth the slight extra effort they are to create. Jason Merrill Bank of America Global Learning Learning & Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Cor Sent: Monday, April 26, 2010 4:23 PM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Thank you. So the personVO.as should look like this: package { class PersonVO { public var firstName:String; public var lastName:String; public var phoneNumber:Number; public var indicatorColor:uint; } } Now I think I understand what you are doing, but I lost to see the benefit of the VO over doing it with a generic Object. Because it is now in a public array I can address everything. Like this: var personVO:PersonVO = new Object(); personVO.firstName = personnodex...@firstname; etc.. Or maybe I don't understand the VO concept??? Regards Cor -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Merrill, Jason Sent: maandag 26 april 2010 15:52 To: Flash Coders List Subject: RE: [Flashcoders] Quick question about dynamic groupings >> Could you extend this with an example on the part of: >>"I typically do is load in XML data and create VOs from that (in my Model >>class) to use in my app." Sure. Here is an example of what the parsing might look like inside your model class. If your XML looked like this: <xml> <people> <person firstName="Hank" lastName="Aaron" phoneNumber="7043237564" indicatorColor="0xe39132" /> <person firstName="Fred" lastName="Astaire" phoneNumber="9082321214" indicatorColor="0xe73721" /> <person firstName="Judy" lastName="Garland" phoneNumber="3107382234" indicatorColor="0xd4e355" /> <person firstName="Marilyn" lastName="Monroe" phoneNumber="3107673721" indicatorColor="0xbab5ab" /> </people> </xml> Then inside your model class, you may have some code like this (which of course would run after the XML is loaded): public var personVOs:Array = []; //array of PersonVOs private function createPersonVOs():void { for each (var personNodeXML:XML in myXML.people.person) { var personVO:PersonVO = new PersonVO(); personVO.firstName = personnodex...@firstname; personVO.lastName = personnodex...@lastname; personVO.phoneNumber = Number(personnodex...@phonenumber); personVO.indicatorColor = uint(personnodex...@indicatorcolor); personVOs.push(personVO); } } So now, you have personVOs as a public property in your model you can call and get the people information from their VO class. Does that help? Jason Merrill Bank of America Global Learning Learning & Performance Solutions Join the Bank of America Flash Platform Community and visit our Instructional Technology Design Blog (note: these are for Bank of America employees only) -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Cor Sent: Saturday, April 24, 2010 6:53 AM To: 'Flash Coders List' Subject: RE: [Flashcoders] Quick question about dynamic groupings Hi Jason, Nice explaination! Thanks! Could you extend this with an example on the part of: "I typically do is load in XML data and create VOs from that (in my Model class) to use in my app." Kind regards Cor van Dooren The Netherlands _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Geen virus gevonden in het binnenkomende-bericht. Gecontroleerd door AVG - www.avg.com Versie: 9.0.814 / Virusdatabase: 271.1.1/2833 - datum van uitgifte: 04/24/10 20:31:00 _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

