<?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>Li Guoliang &#187; Flex</title>
	<atom:link href="http://liguoliang.com/tag/flex/feed/" rel="self" type="application/rss+xml" />
	<link>http://liguoliang.com</link>
	<description>ActionScript Flex Java JEE PHP...</description>
	<lastBuildDate>Mon, 21 May 2012 17:04:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Apache Flex: MXML or ActionScript ?</title>
		<link>http://liguoliang.com/2012/apache-flex-mxml-or-actionscript/</link>
		<comments>http://liguoliang.com/2012/apache-flex-mxml-or-actionscript/#comments</comments>
		<pubDate>Sun, 22 Apr 2012 13:59:08 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[ApacheFlex]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2246</guid>
		<description><![CDATA[Deciding to create components in MXML or ActionScript
&#160;
One of the first decisions that you must make when creating custom components is deciding<p class='read-more'><a href='http://liguoliang.com/2012/apache-flex-mxml-or-actionscript/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<h2>Deciding to create components in MXML or ActionScript</h2>
<p>&nbsp;</p>
<blockquote><p>One of the first decisions that you must make when creating custom components is deciding whether to write<br />
them in MXML or in ActionScript. Ultimately, it is the requirements of your application that determine how you<br />
develop your custom component.<br />
Some basic guidelines include the following:</p>
<p><em><span style="font-size: x-small;">•MXML components and ActionScript components both define new ActionScript classes.<br />
•Almost anything that you can do in a custom ActionScript custom component, you can also do in a custom MXML component. However, for simple components, such as components that modify the behavior of an existing component or add a basic feature to an existing component, it is simpler and faster to create them in MXML.<br />
•When your new component is a composite component that contains other components, and you can express the positions and sizes of those other components using one of the Flex layout containers, you should use MXML to define your component.<br />
•To modify the behavior of the component, such as the way a container lays out its children, use ActionScript.<br />
•To create a visual component by creating a subclass from UIComponent, use ActionScript.<br />
•To create a nonvisual component, such as a formatter, validator, or effect, use ActionScript.<br />
•To add logging support to your control, use ActionScript. For more information, see “Logging” on page 227 in Building and Deploying Adobe Flex 3 Applications.</span></em></p></blockquote>
<p>Flex3 官方文档中如上释疑. 2010年我参加Flex Developer Day时, 有开发者提问国内是否有大型企业应用实例? 未得到正面回答. 倒是群硕的团队还上台张扬了一把, 他们的项目大约是奥运时CCTV直播网站.</p>
<p>其实即便国内有大型的企业应用, 也不一定能获得足够价值的经验.</p>
<p>07年底开始做的教育应用, 大致有120W行代码, 其中有60%+的为AS代码, 除了入口文件及部分复杂UI使用MXML之外, 清一色都是AS代码, 所有的UI都小心谨慎的创建, 销毁. 在10年的DevDay时, 坐在我旁边的某研发他们也是纯AS.</p>
<p>几年过去了, Flex贡献给了Apache, Flex也已经4.6了, 接触的代码多了, 习惯了清纯的AS代码, 当满篇都是MXML标签时, 我不淡定了.</p>
<p>思想斗争良久, 到底孰优孰劣? 在多数common的情况下, 几乎不分上下. 我觉得AS代码更优雅更易读, 可人家说了: 我们可以Design, 不用代码, 一眼就看出来了&#8230;:(</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2012/02/201226212008.png"><img style="display: inline; border: 0px;" title="2012-2-6 21-20-08" src="http://liguoliang.com/wp-content/uploads/2012/02/201226212008_thumb.png" alt="2012-2-6 21-20-08" width="644" height="402" border="0" /></a></p>
<p>如上View, 假如我们只用MXML或只用AS来实现, 似乎看不出明显差异来, 其实相比选择编程方式, 可能对<strong>组件/Class的划分可能更加重要.</strong></p>
<p>不论用MXML还是AS, Class设计好更加关键:</p>
<p>1.1.1 可以设计成一个Common的组件;</p>
<p>1.1 可以作为一个组合的UserList</p>
<p>2.1/2.2  作为显示用户基本信息的组件;</p>
<p>这样划分, 不论MXML还是AS都可以很好的降低耦合, 更可重用, 但不论如何, 我还是喜欢干净的AS代码.</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/apache-flex-mxml-or-actionscript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check FlashPlayer SharedObject setting using ActionScript / 使用AS检查FP本地存储</title>
		<link>http://liguoliang.com/2012/check-flashplayer-sharedobject-setting-using-actionscript-%e4%bd%bf%e7%94%a8as%e6%a3%80%e6%9f%a5fp%e6%9c%ac%e5%9c%b0%e5%ad%98%e5%82%a8/</link>
		<comments>http://liguoliang.com/2012/check-flashplayer-sharedobject-setting-using-actionscript-%e4%bd%bf%e7%94%a8as%e6%a3%80%e6%9f%a5fp%e6%9c%ac%e5%9c%b0%e5%ad%98%e5%82%a8/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 13:45:00 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[ApacheFlex]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[FlashPlayer]]></category>
		<category><![CDATA[Tools]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2256</guid>
		<description><![CDATA[FlashPlayer provide a cool local storage mechanism called ‘<a href="http://livedocs.adobe.com/flex/3/html/help.html?content=lsos_3.html">SharedObject’</a>,&#160; we can store some user info in user local machine. for example, douban<p class='read-more'><a href='http://liguoliang.com/2012/check-flashplayer-sharedobject-setting-using-actionscript-%e4%bd%bf%e7%94%a8as%e6%a3%80%e6%9f%a5fp%e6%9c%ac%e5%9c%b0%e5%ad%98%e5%82%a8/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>FlashPlayer provide a cool local storage mechanism called ‘<a href="http://livedocs.adobe.com/flex/3/html/help.html?content=lsos_3.html">SharedObject’</a>,&nbsp; we can store some user info in user local machine. for example, douban.fm store the last channel in sharedObject.</p>
<p>You can check the local storage setting for current domain by right click, or check all setting from Control Panel&gt;FlashPlayer, additionally, you can manage all settings by this: <a href="http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html">http://www.macromedia.com/support/documentation/en/flashplayer/help/settings_manager07.html</a></p>
<p>Flashplayer need the user configure this setting manually, but some times we want change the setting automatically, especially for some enterprise application, like E-Learning, Banking, HIS.</p>
<p>Currently, I did not found any API or workaround to change the local storage automatically <img src='http://liguoliang.com/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>I just write a small tool to check the local storage setting directly, &gt;&gt;<a href="http://liguoliang.com/wp-content/uploads/2012/02/FPLocalStorageCheckUtil.swf">Link</a>&lt;&lt; <br />(you may download and upload this swf to your server if needed)</p>
<p><img style="border-right-width: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; margin-left: auto; border-left-width: 0px; margin-right: auto" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2012/02/image_thumb.png" width="565" height="449"><br />&nbsp;</p>
<pre class="java" name="code">/**
	 * Check local storage setting.
	 */
	protected function checkLocalStorage(event:MouseEvent):void
	{
		var sharedObjectForTest:SharedObject = SharedObject.getLocal("sharedObjectTest", "/");

		sharedObjectForTest.addEventListener(NetStatusEvent.NET_STATUS, onSharedObjectEvent);
		sharedObjectForTest.data.result = "OK";
		try
		{
			var result:String = sharedObjectForTest.flush();
			if(result == SharedObjectFlushStatus.FLUSHED) {
				traceLog("OK, and currect size is: " + sharedObjectForTest.size);
			}else {
				traceLog("Failed, and the Flashplayer security setting panel is shown.");
			}
		}
		catch(error:Error)
		{
			traceLog("Error, and show the seeting panel manually;");
			Security.showSettings(SecurityPanel.LOCAL_STORAGE);
		}
	}
</pre>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/check-flashplayer-sharedobject-setting-using-actionscript-%e4%bd%bf%e7%94%a8as%e6%a3%80%e6%9f%a5fp%e6%9c%ac%e5%9c%b0%e5%ad%98%e5%82%a8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FlashBuilder: 如何根据序列号确定其对应版本?</title>
		<link>http://liguoliang.com/2012/get-flash-builder-version-by-license-code/</link>
		<comments>http://liguoliang.com/2012/get-flash-builder-version-by-license-code/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 15:29:06 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Apache Flex]]></category>
		<category><![CDATA[FlexBuilder]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2237</guid>
		<description><![CDATA[如何根据序列号确定其对应版本?
<a href="http://liguoliang.com/wp-content/uploads/2012/01/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2012/01/image_thumb.png" width="510" height="494"/></a>
由于之前采购过不同版本的FB, 具体序列号对应版本早已记不清楚, 于是微博上@了几个专家, 尚未收到任何答复的情况下直接拨打Adobe的客服:
<strong>中国</strong>10800 744 0438（通过联通），或 10800 440 0421（通过电信）[<a href="http://shop.adobe.com/store/adbehcn/Content/pbPage.faq">http://shop.ado</a><p class='read-more'><a href='http://liguoliang.com/2012/get-flash-builder-version-by-license-code/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>如何根据序列号确定其对应版本?</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2012/01/image.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2012/01/image_thumb.png" width="510" height="494"></a></p>
<p>由于之前采购过不同版本的FB, 具体序列号对应版本早已记不清楚, 于是微博上@了几个专家, 尚未收到任何答复的情况下直接拨打Adobe的客服:</p>
<p><strong>中国</strong>10800 744 0438（通过联通），或 10800 440 0421（通过电信）[<a href="http://shop.adobe.com/store/adbehcn/Content/pbPage.faq">http://shop.adobe.com/store/adbehcn/Content/pbPage.faq</a>]
<p>报出序列号之后客服耐心回答了版本跟授权的问题.
<p>从4.0升级到4.5大致需要415RMB, 从4.5到4.6是不需要费用的, 明年回来就有4.6可用了&#8230;.</p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/get-flash-builder-version-by-license-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScript: Check if a xml attribute/element exists 检查XML属性/元素是否存在</title>
		<link>http://liguoliang.com/2012/actionscript-check-if-a-xml-attributeelement-exists/</link>
		<comments>http://liguoliang.com/2012/actionscript-check-if-a-xml-attributeelement-exists/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 16:21:03 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ApacheFlex]]></category>
		<category><![CDATA[Flex]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2228</guid>
		<description><![CDATA[Here is the XML:
<code>&#60;XeSex sexIDElement='MID'&#62; &#60;SexID&#62; M &#60;/SexID&#62; &#60;Name&#62; Male &#60;/Name&#62; &#60;Active&#62; y &#60;/Active&#62; &#60;</code><p class='read-more'><a href='http://liguoliang.com/2012/actionscript-check-if-a-xml-attributeelement-exists/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Here is the XML:</p>
<p><code>&lt;XeSex sexIDElement='MID'&gt; &lt;SexID&gt; M &lt;/SexID&gt; &lt;Name&gt; Male &lt;/Name&gt; &lt;Active&gt; y &lt;/Active&gt; &lt;Code&gt; M &lt;/Code&gt; &lt;/XeSex&gt; </code>
<p>Attitude:&nbsp; sexIDElement = ‘MID’;<br />Element: Name = Male</p>
<p><code class="java" name="code">trace(xmlTest.hasOwnProperty('@sexIDElement')); // check if the attribute exists trace(xmlTest.hasOwnProperty('Name')); // check if the element exists</code></p>
<p>BTW, About: <a href="http://www.w3schools.com/dtd/dtd_el_vs_attr.asp">XML Elements vs. Attributes</a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/actionscript-check-if-a-xml-attributeelement-exists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex Build: org.xml.sax.SAXParseException :The entity name must immediately follow the &#8216;&amp;&#8217; in the entity reference</title>
		<link>http://liguoliang.com/2012/org-xml-sax-saxparseexception-the-entity-name-must-immediately-follow/</link>
		<comments>http://liguoliang.com/2012/org-xml-sax-saxparseexception-the-entity-name-must-immediately-follow/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 15:25:16 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[ApacheFlex]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[SAXParseException]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2226</guid>
		<description><![CDATA[在过去接近4年的时间里, 很少使用MXML, 几乎都是纯AS, 最近操作了一点点MXML, 譬如:
<code>&#60;s:Button enabled=”isDirty() &#38;&#38; canSaveNow()” /&#62;</code>
&#160;
在build的时候遇到错误: 
org.xml.sax.SA<p class='read-more'><a href='http://liguoliang.com/2012/org-xml-sax-saxparseexception-the-entity-name-must-immediately-follow/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>在过去接近4年的时间里, 很少使用MXML, 几乎都是纯AS, 最近操作了一点点MXML, 譬如:</p>
<p><code>&lt;s:Button enabled=”isDirty() &amp;&amp; canSaveNow()” /&gt;</code>
<p>&nbsp;</p>
<p>在build的时候遇到错误: </p>
<blockquote><p>org.xml.sax.SAXParseException :The entity name must immediately follow the ‘&amp;’ in the entity reference</p>
</blockquote>
<p>Google了一下, XML解析的问题, 解决方法:</p>
<p>&amp;&amp; 替换为:&nbsp; [&amp;amp;&amp;amp;]</p>
<p><code>&lt;s:Button enabled=”isDirty() &amp;amp;&amp;amp; canSaveNow()” /&gt;</code></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2012/org-xml-sax-saxparseexception-the-entity-name-must-immediately-follow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to display errorString in a Datagrid ItemEditor?</title>
		<link>http://liguoliang.com/2011/how-to-display-errorstring-in-a-datagrid-itemeditor/</link>
		<comments>http://liguoliang.com/2011/how-to-display-errorstring-in-a-datagrid-itemeditor/#comments</comments>
		<pubDate>Mon, 19 Dec 2011 14:38:42 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[itemEditor]]></category>

		<guid isPermaLink="false">http://liguoliang.com/?p=2205</guid>
		<description><![CDATA[There is a datagrid displaying users:
<a href="http://liguoliang.com/wp-content/uploads/2011/12/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/12/image_thumb1.png" width="320" height="185"/></a>
And this datagrid is editable ,&#160; we can modify username directly, by default, Flex will use TextInput as t<p class='read-more'><a href='http://liguoliang.com/2011/how-to-display-errorstring-in-a-datagrid-itemeditor/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>There is a datagrid displaying users:</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2011/12/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/12/image_thumb1.png" width="320" height="185"></a></p>
<p>And this datagrid is editable ,&nbsp; we can modify username directly, by default, Flex will use TextInput as the item editor.</p>
<p>I want to display some error mesg in a datagrid ItemEditor when use input is invalidate.</p>
<h4>Using Alert – not good enough</h4>
<p>So I add a listener to the item edit complete Event:</p>
<pre class="java" name="code">	/**
	 * validate user input, revert the original value if necessary.
	 */
	protected function datagirdTest_itemEditEndHandler(event:DataGridEvent):void {
		if(event.dataField != "Name") { // chech the field;
			return;
		}
		var input:String = (datagirdTest.itemEditorInstance as TextInput).text; // get the user input data.
		if(input == null || input == "") {
			event.preventDefault(); // prevent default behavior
			(datagirdTest.itemEditorInstance as TextInput).text = (event.itemRenderer.data as XML).Name;// Undo: revert the original data by the selected item.
			Alert.show(errorMesg);
			return;
		}
	}
</pre>
<p>It can work correctly, but our client think we should not change user input directly. so I comment off the undo line: </p>
<pre class="java" name="code">	/**
	 * validate user input, revert the original value if necessary.
	 */
	protected function datagirdTest_itemEditEndHandler(event:DataGridEvent):void {
		if(event.dataField != "Name") { // chech the field;
			return;
		}
		var input:String = (datagirdTest.itemEditorInstance as TextInput).text; // get the user input data.
		if(input == null || input == "") {
			event.preventDefault(); // prevent default behavior
			//HERE: (datagirdTest.itemEditorInstance as TextInput).text = (event.itemRenderer.data as XML).Name;// Undo: revert the original data by the selected item.
			Alert.show(errorMesg);
			return;
		}
	}
</pre>
<p>Unfortunately, because of ‘Alert’, itemEditComplete Event will dispatch many times, so there’ll be many alert in the UI. </p>
<p>&nbsp;</p>
<h4>Using Error message in item editor – can not work correctly</h4>
<p>So, I want to display the error message in the item editor , like this: </p>
<p><a href="http://liguoliang.com/wp-content/uploads/2011/12/image2.png"><img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/12/image_thumb2.png" width="399" height="189"></a></p>
<p>and here is the handler: </p>
<pre class="java" name="code">	/**
	 * validate user input.
	 */
	protected function datagirdTest_itemEditEndHandler(event:DataGridEvent):void {
		if(event.dataField != "Name") { // check the field;
			return;
		}

		var editor:TextInput = datagirdTest.itemEditorInstance as TextInput;
		var input:String = editor.text; // get the user input data.
		if(input == null || input == "") {
			// event.preventDefault(); // prevent default behavior
			event.stopImmediatePropagation();
			editor.errorString = "User name cannot be empty!";
			trace("Error");
			// datagirdTest.destroyItemEditor();
		}else {
			editor.errorString = null;
		}
	}
</pre>
<p>Now I can display the error mesg as the above screen capture, but if the user want to reload the data or sort the column, the editor will stay there until I call datagrid.destroyItemEditor(), but:</p>
<p>“This method closes an item editor currently open on an item renderer. You typically only call this method from within the event listener for the <code>itemEditEnd</code> event, after you have already called the <code>preventDefault()</code> method to prevent the default event listener from executing.” <a href="http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/DataGrid.html#destroyItemEditor()">http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/controls/DataGrid.html#destroyItemEditor()</a></p>
<p><strong>so, How can I display the error message in this way?</strong></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2011/how-to-display-errorstring-in-a-datagrid-itemeditor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex: verticalScrollPolicy auto/on/off</title>
		<link>http://liguoliang.com/2011/flex-scroll-policy/</link>
		<comments>http://liguoliang.com/2011/flex-scroll-policy/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 15:54:52 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[ScrollPolicy]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2011/flex-scroll-policy/</guid>
		<description><![CDATA[最近碰到一个问题: 当Flex右侧垂直滚动条出现时, 下方水平滚动条必定随之出现, 详细的描述就是:
该UIComponent高度一定, 宽度设置为percent(也就是说宽度可以变化), 当Add一个内部组件到该UI上后, UI需要更多高度, 但高度一定, 只好出现右侧滚动条(默认的ScrollP<p class='read-more'><a href='http://liguoliang.com/2011/flex-scroll-policy/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>最近碰到一个问题: 当Flex右侧垂直滚动条出现时, 下方水平滚动条必定随之出现, 详细的描述就是:</p>
<p>该UIComponent高度一定, 宽度设置为percent(也就是说宽度可以变化), 当Add一个内部组件到该UI上后, UI需要更多高度, 但高度一定, 只好出现右侧滚动条(默认的ScrollPolicy为auto), 假使被增加组件的宽度与外部组件宽度一致, 此时由于滚动条的出现, 外部UI不能直接完整显示该组件, 于是出现水平滚动条,.</p>
<p>Flex API中有关内容: Sizing components <a title="http://livedocs.adobe.com/flex/3/html/help.html?content=size_position_3.html" href="http://livedocs.adobe.com/flex/3/html/help.html?content=size_position_3.html">http://livedocs.adobe.com/flex/3/html/help.html?content=size_position_3.html</a></p>
<p>参考: <a name="244554"></a><strong>Using Scroll bars一章:</strong></p>
<blockquote><p>Notice that the addition of the scroll bar doesn&#8217;t increase the height of the container from its initial value. Flex considers scroll bars in its sizing calculations only if you explicitly set the scroll policy to</p>
<p><samp>ScrollPolicy.ON</samp>. So, if you use an auto scroll policy (the default), the scroll bar overlaps the buttons. To prevent this behavior, you can set the</p>
<p><samp>height</samp>property for the HBox container or allow the HBox container to resize by setting a percentage-based width. Remember that changing the height of the HBox container causes other components in your application to move and resize according to their own sizing rules.</p></blockquote>
<p>解决方案比较清晰, 要么设置ScrollPoliocy为No, 要么调整宽高设置. 为了清晰演示, 写了个小Application:</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2011/12/Flex3TestWeb_ScrollPolicy.swf">Flex3TestWeb_ScrollPolicy</a></p>
<p><object width="500" height="500" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="play" value="true" /><param name="quality" value="high" /><param name="src" value="http://liguoliang.com/wp-content/uploads/2011/12/Flex3TestWeb_ScrollPolicy.swf" /><param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" /><embed width="600" height="500" type="application/x-shockwave-flash" src="http://liguoliang.com/wp-content/uploads/2011/12/Flex3TestWeb_ScrollPolicy.swf" play="true" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" /></object></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2011/flex-scroll-policy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex: 检查/撤销Datagrid编辑数据 Validate/revert editable Datagrid input value</title>
		<link>http://liguoliang.com/2011/validaterevert-editable-datagrid-input-value/</link>
		<comments>http://liguoliang.com/2011/validaterevert-editable-datagrid-input-value/#comments</comments>
		<pubDate>Mon, 05 Dec 2011 13:42:11 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[DataGrid]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[itemEditor]]></category>
		<category><![CDATA[UI]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2011/flex-%e6%a3%80%e6%9f%a5%e6%92%a4%e9%94%80datagrid%e7%bc%96%e8%be%91%e6%95%b0%e6%8d%ae-validaterevert-editable-datagrid-input-value/</guid>
		<description><![CDATA[Requirement: We want to validate user input in editable datagrid, and revert the original value(undo) if necessary.
Solution: Handle the ‘itemEditEnd’<p class='read-more'><a href='http://liguoliang.com/2011/validaterevert-editable-datagrid-input-value/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Requirement: We want to validate user input in editable datagrid, and revert the original value(undo) if necessary.</p>
<p>Solution: Handle the ‘itemEditEnd’ Event dispatched by the datagrid.</p>
<p>Codes:</p>
<pre class="java" name="code">	/**
	 * validate user input, revert the original value if necessary.
	 */
	protected function datagirdTest_itemEditEndHandler(event:DataGridEvent):void {
		if(event.dataField != "Name") { // chech the field;
			return;
		}
		var input:String = (datagirdTest.itemEditorInstance as TextInput).text; // get the user input data.
		if(input == null || input == "") {
			event.preventDefault(); // prevent default behavior
			// var filed:String = (datagirdTest.columns[event.columnIndex] as DataGridColumn).editorDataField;
			// trace(datagirdTest.itemEditorInstance[filed]);
			(datagirdTest.itemEditorInstance as TextInput).text = (event.itemRenderer.data as XML).Name;// Undo: revert the original data by the selected item.
			Alert.show(errorMesg);
			return;
		}
	}
</pre>
<p>Screen caputre: </p>
</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2011/12/image.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/12/image_thumb.png" width="512" height="406"></a> </p>
<p>User input is empty, we got the Event, prevent the default behavior, and revert the value form the modeling.</p>
<p>Ref:</p>
<p>1. itemEditEnd called multiple times <a title="http://forums.adobe.com/message/2459209" href="http://forums.adobe.com/message/2459209">http://forums.adobe.com/message/2459209</a><br />2. Using cell editing events&nbsp; &#8211; <a title="http://livedocs.adobe.com/flex/3/html/help.html?content=celleditor_7.html" href="http://livedocs.adobe.com/flex/3/html/help.html?content=celleditor_7.html">http://livedocs.adobe.com/flex/3/html/help.html?content=celleditor_7.html</a></p>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2011/validaterevert-editable-datagrid-input-value/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex/Flash font style viewer&#8211;Flex/Flash字体预览器</title>
		<link>http://liguoliang.com/2011/flexflash-font-style-viewer/</link>
		<comments>http://liguoliang.com/2011/flexflash-font-style-viewer/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 14:22:17 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[Flex font]]></category>
		<category><![CDATA[Flex设置字体样式]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2011/flexflash-font-style-viewerflexflash%e5%ad%97%e4%bd%93%e9%a2%84%e8%a7%88%e5%99%a8/</guid>
		<description><![CDATA[Based on your fonts installed on your local machine, view the font style.
<a href="http://liguoliang.com/wp-content/uploads/2011/11/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/11/image_thumb1.png" width="601" height="411"/></a>
Link: <a href="http://liguoliang.com/pub/utils/FlashFontStyleViewer.html">http://liguoliang.com/pub/utils/FlashFontStyleViewer.html</a>
Code:
// ha<p class='read-more'><a href='http://liguoliang.com/2011/flexflash-font-style-viewer/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>Based on your fonts installed on your local machine, view the font style.</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2011/11/image1.png"><img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/11/image_thumb1.png" width="601" height="411"></a></p>
<p>Link: <a href="http://liguoliang.com/pub/utils/FlashFontStyleViewer.html">http://liguoliang.com/pub/utils/FlashFontStyleViewer.html</a></p>
<p>Code:</p>
<pre class="java" name="code">// handle click, get the info, and generate Labels.
		protected function buttonPreview_clickHandler(event:MouseEvent):void {
			var textFontFamilyRaw:String = textFontFamily.text == null ? "" : StringUtils.trim(textFontFamily.text);
			if(StringUtils.isWhiteSpace(textFontFamilyRaw)) {
				Alert.show("Please input some font-family");
				return;
			}

			var arrayFontFamily:Array = textFontFamilyRaw.split("\n");
			var textDisplay:String = textToView.text;
			if(textDisplay == null || StringUtils.isEmptyString(textDisplay)) {
				textDisplay = "Flex上海用户组";
			}
			var fontSize:int = comboBoxFontSize.selectedItem as int;

			showPreview(arrayFontFamily, fontSize,textDisplay, checkBoxIsBold.selected);

		}

		// For each font-family, create a Label and set style, add all labels on stage.
		private function showPreview(arrayFontFamily:Array, fontSize:int = 12, text:String="Flex上海用户组", isBold:Boolean= false):void {
			vGroupLabels.removeAllElements();
			for each(var fontFamily:String in arrayFontFamily) {
				var label:Label = new Label();
				label.text = text + "[" + fontFamily + " - " + fontSize + "pt]";
				label.setStyle(FlexConstants.STYLE_FONT_FAMILY, fontFamily);
				label.setStyle(FlexConstants.STYLE_FONT_SIZE, fontSize);
				if(isBold) {
					label.setStyle(FlexConstants.STYLE_FONT_WEIGHT, "bold");
					label.text += "  - Bold";
				}
				vGroupLabels.addElement(label);
			}
		}
</pre>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2011/flexflash-font-style-viewer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>推荐:Chrome下ActionScript API 搜索插件</title>
		<link>http://liguoliang.com/2011/%e6%8e%a8%e8%8d%90chrome%e4%b8%8bactionscript-api-%e6%90%9c%e7%b4%a2%e6%8f%92%e4%bb%b6/</link>
		<comments>http://liguoliang.com/2011/%e6%8e%a8%e8%8d%90chrome%e4%b8%8bactionscript-api-%e6%90%9c%e7%b4%a2%e6%8f%92%e4%bb%b6/#comments</comments>
		<pubDate>Wed, 26 Oct 2011 13:34:16 +0000</pubDate>
		<dc:creator>Guoliang</dc:creator>
				<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[ActionScript API辅助工具]]></category>

		<guid isPermaLink="false">http://liguoliang.com/2011/%e6%8e%a8%e8%8d%90chrome%e4%b8%8bactionscript-api-%e6%90%9c%e7%b4%a2%e6%8f%92%e4%bb%b6/</guid>
		<description><![CDATA[A Chrome plugin for: ActionScript 3.0 Reference.Input &#8220;as3 + &#8216;space&#8217;&#8221; and keywords:
<a href="http://liguoliang.com/wp-content/uploads/2011/10/image3.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/10/image_thumb3.png" width="633" height="220"/></a>
<a href="http://blogs.adobe.com/flexdoc">Flex Doc Team</a> Blog 推荐: Chrome浏览器下AS文档的搜索插<p class='read-more'><a href='http://liguoliang.com/2011/%e6%8e%a8%e8%8d%90chrome%e4%b8%8bactionscript-api-%e6%90%9c%e7%b4%a2%e6%8f%92%e4%bb%b6/'>More...</a></p><p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></description>
			<content:encoded><![CDATA[<p>A Chrome plugin for: ActionScript 3.0 Reference.<br />Input &#8220;as3 + &#8216;space&#8217;&#8221; and keywords:</p>
<p><a href="http://liguoliang.com/wp-content/uploads/2011/10/image3.png"><img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://liguoliang.com/wp-content/uploads/2011/10/image_thumb3.png" width="633" height="220"></a></p>
<p><a href="http://blogs.adobe.com/flexdoc">Flex Doc Team</a> Blog 推荐: Chrome浏览器下AS文档的搜索插件, &#8216;as3 + 空格键&#8217; 输入关键字后激发选项, 方便易用.</p>
<p>&gt;&gt;<a href="https://chrome.google.com/webstore/detail/agjdnfifalomicffgfocgdgpbnkkefle?hl=en-US">ActionScript 3.0 Search</a> plugin homepage&lt;&lt;</p>
<p>&nbsp;</p>
<blockquote><p>This extension integrates with the Chrome omnibox to bring ActionScript 3.0 standard library API autocompletion right to your fingertips. To use, type &#8220;as3&#8243;, followed by a space or tab, followed by your query. The first time you use the extension, there may be some delay, as the class index is retrieved and cached. On subsequent uses, however, you should see instantaneous autocompletions. Selecting a completion or fully typing a class name and then pressing enter will take you directly to the relevant documentation. If a completion cannot be found, several search suggestions will be provided, including using the Adobe Community Help search function, using Google Codesearch, and using the Development and Coding Search custom search engine. If you experience any issues with this extension, please use the bug tracker given below.
<p>== Chrome Omnibox Search Extensions for Developers==<br />If you like this extension, you might also like the other omnibox search extensions given at the following link:<br />http://code.google.com/p/developer-omniboxes-for-chrome/</p>
</blockquote>
<p><p>

----------Post from: <a href="http://liguoliang.com">@LiGuoliang.com, 欢迎回来~</a>----------</p></p>
]]></content:encoded>
			<wfw:commentRss>http://liguoliang.com/2011/%e6%8e%a8%e8%8d%90chrome%e4%b8%8bactionscript-api-%e6%90%9c%e7%b4%a2%e6%8f%92%e4%bb%b6/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

