<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Khainer&#039;s Blog</title>
	<atom:link href="http://khainer.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://khainer.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Wed, 06 Jan 2010 15:37:14 +0000</lastBuildDate>
	<language></language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='khainer.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Khainer&#039;s Blog</title>
		<link>http://khainer.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://khainer.wordpress.com/osd.xml" title="Khainer&#039;s Blog" />
	<atom:link rel='hub' href='http://khainer.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Dynamic ItemRenderer by Object Type</title>
		<link>http://khainer.wordpress.com/2010/01/06/hello-world/</link>
		<comments>http://khainer.wordpress.com/2010/01/06/hello-world/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 10:28:17 +0000</pubDate>
		<dc:creator>khainer</dc:creator>
				<category><![CDATA[Flex3]]></category>
		<category><![CDATA[Dynamic ItemRenderer]]></category>
		<category><![CDATA[List]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[For some occasions you might need a list containing different types of object types. You want to display every object type differently. This kind of nullifies the use of a list, because a list should only contain 1 type. But I want it anyway! I could only find one person who wanted to achieve the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khainer.wordpress.com&amp;blog=11275754&amp;post=1&amp;subd=khainer&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>For some occasions you might need a list containing different types of object types. You want to display every object type differently. This kind of nullifies the use of a list, because a list should only contain 1 type. But I want it anyway!</p>
<p>I could only find one person who wanted to achieve the same goal as I did. <a href="http://www.mail-archive.com/flexcoders@yahoogroups.com/msg33986.html" target="_blank">David Rousselie&#8217;s solution</a> didn&#8217;t work for me, however the comment made by Ralf Bokelberg in the mail archives gave me the answer.</p>
<blockquote>
<pre>How about using an itemRenderer with states and setting the state
dependent on the type of data?</pre>
</blockquote>
<p>And thats exactly what needs to be done. Create any list component you want and create your own ItemRenderer. Let the list use the Itemrenderer. Inside your own itemrenderer you need to override the set data function to check the object type and change to the appropriate state. You can define every state you want. Add the child components you want and use the <em>data.value</em> to use the actual object from the list.</p>
<pre>
<blockquote>

public override function set data(value:Object): void {
	super.data = value;
	if (value is ImageObject) {
		currentState = "IMAGE";
	} else if (value is TextObject) {
		currentState = "TEXT";
	}
}</blockquote>
</pre>
<p>Don&#8217;t forget the <em>super.data = value</em> statement. In every state you can define the components you want. You can access the different objecttypes in each state without one interfering the other.</p>
<p>With this being said I did found one other nifty way to implement Dynamic Itemrenderers but uses a different definition of the dynamic part: <a href="http://www.themorphicgroup.com/blog/2008/09/15/example-of-feature-rich-itemrenderers-in-flex/" target="_self">click here</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/khainer.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/khainer.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/khainer.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/khainer.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/khainer.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/khainer.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/khainer.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/khainer.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/khainer.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/khainer.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/khainer.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/khainer.wordpress.com/1/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/khainer.wordpress.com/1/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/khainer.wordpress.com/1/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=khainer.wordpress.com&amp;blog=11275754&amp;post=1&amp;subd=khainer&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://khainer.wordpress.com/2010/01/06/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/0df148cdba0ca9ba9b931f780018f9b4?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">khainer</media:title>
		</media:content>
	</item>
	</channel>
</rss>
