<?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>The Boschmans Account &#187; actionscript</title>
	<atom:link href="http://www.boschmans.net/tag/actionscript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.boschmans.net</link>
	<description>A collection of interests and happenings...</description>
	<lastBuildDate>Mon, 19 Jul 2010 19:36:37 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Aarghl! Error #1034 Type Coercion failed: Cannot convert something to something</title>
		<link>http://www.boschmans.net/2009/07/14/aarghl-error-1034-type-coercion-failed-cannot-convert-something-to-something/</link>
		<comments>http://www.boschmans.net/2009/07/14/aarghl-error-1034-type-coercion-failed-cannot-convert-something-to-something/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 21:01:23 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[actionscript]]></category>
		<category><![CDATA[flex3]]></category>

		<guid isPermaLink="false">http://www.boschmans.net/?p=712</guid>
		<description><![CDATA[The error &#8220;Type Coercion failed: cannot convert [#78F6AA, #CAF2DA] to Array&#8221; has stared me in the face for the past few days or so. The error actually has useful information in it (but at the moment I got it, ofcourse I never properly read it&#8230;). It states that whatever you are doing, you are passing [...]]]></description>
			<content:encoded><![CDATA[<p>The error &#8220;Type Coercion failed: cannot convert [#78F6AA, #CAF2DA] to Array&#8221; has stared me in the face for the past few days or so.</p>
<p>The error actually has useful information in it (but at the moment I got it, ofcourse I never properly read it&#8230;). It states that whatever you are doing, you are passing the wrong type of variable to the function/variable. It expects it to be in another type.</p>
<p>This blog <a href="http://www.judahfrangipane.com/blog/?p=141">entry</a> helped me to understand the error message.</p>
<p>I wanted to implement a function so the user can select his own gradient colors and save them as a preference for my AIR app. cp1 and cp2 are 2 flex colorpicker functions.</p>
<p>&#8230;<br />
<mx :SetStyle name="backgroundGradientColors" value="[{colors_selected}]"/><br />
&#8230;<br />
[Bindable] private var colors_selected:Array = [cp1.selectedColor, cp2.selectedColor];<br />
&#8230;</p>
<p>However, everytime I ran the program I got the Type Coercion error.</p>
<p>Finally I found out what&#8217;s wrong. I made an array out of both colorpicker selected colors, and then passed it to backgroundGradientColors <em>in another array</em>.<br />
Duh (Smacks head) !<br />
Of course it doesn&#8217;t like it ! Below is the corrected code. The mx:SetStyle now does not specify an array, as this is constructed in the variable colors_selected.</p>
<p>&#8230;<br />
<mx :SetStyle name="backgroundGradientColors" value="{colors_selected}"/><br />
&#8230;<br />
[Bindable] private var colors_selected:Array = [cp1.selectedColor, cp2.selectedColor];<br />
&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.boschmans.net/2009/07/14/aarghl-error-1034-type-coercion-failed-cannot-convert-something-to-something/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
