A Flex Annoyance

In Flex, it’s not very clear that the iterator you want to use on a Dictionary type to loop over the keys is simply for..in rather than for each..in.

Dodongo is actually Everyman

Of course, the Flex compiler doesn’t care. It’s baffling why there can’t be simply one iterator syntax in the language, and maybe useful collections on the Dictionary type like .keys or .values? I wonder sometimes if Adobe just creates things only for the sake of trying be different.

// NOTE: use of for..in instead of for each..in
for (var obj:Object in this._roomConfigurationRateMap) {
    var configuration:RoomConfigurationVO = obj as RoomConfigurationVO;
    var configurationXML:XML = <room-type/>;
    configurationXML.@code = configuration.type.code;
    configurationXML.@bestFlexRate = this._roomConfigurationRateMap[configuration];

for each (var date:DatePair in this.blackoutDates) {
    var dateXML:XML = <item/>;
    dateXML.@startDate = XmlUtilities.formatDate(date.startDate);
    dateXML.@endDate = XmlUtilities.formatDate(date.endDate);
This entry was posted in Dev. Bookmark the permalink. Follow comments with the RSS feed for this post. Post a comment or leave a trackback: Trackback URL.

Post a Comment

Your email is kept private.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>