<?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/"
	>

<channel>
	<title>SavageLook.com &#187; flex 4</title>
	<atom:link href="http://savagelook.com/blog/tag/flex-4/feed" rel="self" type="application/rss+xml" />
	<link>http://savagelook.com/blog</link>
	<description>Blowing your mind, one line of code at a time</description>
	<lastBuildDate>Tue, 15 May 2012 13:27:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Flash Builder 4: addElement() instead of addChild()</title>
		<link>http://savagelook.com/blog/actionscript3/flash-builder-4-addelement-instead-of-addchild</link>
		<comments>http://savagelook.com/blog/actionscript3/flash-builder-4-addelement-instead-of-addchild#comments</comments>
		<pubDate>Tue, 27 Jul 2010 12:56:08 +0000</pubDate>
		<dc:creator>Tony Lukasavage</dc:creator>
				<category><![CDATA[ActionScript3]]></category>
		<category><![CDATA[Blog]]></category>
		<category><![CDATA[Flash Builder 4]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flex 4]]></category>

		<guid isPermaLink="false">http://savagelook.com/blog/?p=210</guid>
		<description><![CDATA[Here&#8217;s a quick tip for those of you who are also switching to Flex 4.x/Flash Builder 4 from Flex 3.x/Flex Builder 3.  In the past when you wanted to add a Flash DisplayObject to the main Application canvas you&#8217;d wrap the DisplayObject in a UIComponent, then add the UIComponent to the Application as a child, [...]<p><a href="http://savagelook.com/blog/actionscript3/flash-builder-4-addelement-instead-of-addchild">Flash Builder 4: addElement() instead of addChild()</a> is a post from: <a href="http://savagelook.com/blog">SavageLook.com</a></p>
]]></description>
			<content:encoded><![CDATA[<!-- Start Shareaholic LikeButtonSetTop Automatic --><!-- End Shareaholic LikeButtonSetTop Automatic --><p>Here&#8217;s a quick tip for those of you who are also switching to Flex 4.x/Flash Builder 4 from Flex 3.x/Flex Builder 3.  In the past when you wanted to add a Flash DisplayObject to the main Application canvas you&#8217;d wrap the DisplayObject in a UIComponent, then add the UIComponent to the Application as a child, like this:</p>
<pre style="background:#cccccc;"><code style="color:#000000; font-weight:bold; font-size:1.1em;">var sprite:Sprite = new Sprite();
var ui:UIComponent = new UIComponent();
ui.addChild(sprite);
this.addChild(ui);</code></pre>
<p></p>
<p>Try that in Flash Builder 4 and you&#8217;ll encounter a fun error that looks like this:</p>
<pre style="background:#cccccc;"><code style="color:#000000; font-weight:bold; font-size:1.1em;">Error: addChild() is not available in this class. Instead, use
addElement() or modify the skin, if you have one.</code></pre>
<p></p>
<p>To resolve it, simply change the last line of the previous code to use addElement() instead (change in <span style="color: #ff0000;">red</span>):</p>
<pre style="background:#cccccc;"><code style="color:#000000; font-weight:bold; font-size:1.1em;">var sprite:Sprite = new Sprite();
var ui:UIComponent = new UIComponent();
ui.addChild(sprite);
&lt;span style="color: #ff0000;"&gt;this.addElement(ui);&lt;/span&gt;</code></pre>
<p></p>
<p><a href="http://savagelook.com/blog/actionscript3/flash-builder-4-addelement-instead-of-addchild">Flash Builder 4: addElement() instead of addChild()</a> is a post from: <a href="http://savagelook.com/blog">SavageLook.com</a></p>
<div class="shr-publisher-210"></div><!-- Start Shareaholic LikeButtonSetBottom Automatic --><!-- End Shareaholic LikeButtonSetBottom Automatic -->]]></content:encoded>
			<wfw:commentRss>http://savagelook.com/blog/actionscript3/flash-builder-4-addelement-instead-of-addchild/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
	</channel>
</rss>
<!-- WP Super Cache is installed but broken. The path to wp-cache-phase1.php in wp-content/advanced-cache.php must be fixed! -->
