<?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>be easy</title>
	<atom:link href="http://www.beasy.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.beasy.org</link>
	<description>beasy&#039;s blog - All about flex, as3, air, framework, design pattern</description>
	<lastBuildDate>Mon, 10 Oct 2011 02:29:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Flex4 实现拖拽缓动</title>
		<link>http://www.beasy.org/2011/10/flex4-drag-animation-easing/</link>
		<comments>http://www.beasy.org/2011/10/flex4-drag-animation-easing/#comments</comments>
		<pubDate>Sun, 09 Oct 2011 17:11:11 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[原创文章]]></category>
		<category><![CDATA[Flex4]]></category>
		<category><![CDATA[Scroller]]></category>
		<category><![CDATA[Skin]]></category>
		<category><![CDATA[Touch]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=213</guid>
		<description><![CDATA[你有在做类似Google地图这种拖拽缓动效果的应用吗？你还在为写缓动加速算法而头痛吗？如果是那么你看了下面的文章内容后你肯定会大骂一句：“TMD，原来这么简单！”。。。 费话少说，先看一下效果吧(由于是国外服务器，flash和图片加载有点慢，有请耐心等待)： 效果怎么样，是不是很流畅呢！ 从Demo外表可以看出他是基于Flex的Scroller组件实现的，具体代码如下： &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:Application xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/mx&#34;&#62; &#60;s:Scroller width=&#34;100%&#34; height=&#34;100%&#34; interactionMode=&#34;touch&#34;&#62; &#60;s:Group&#62; &#60;s:Image source=&#34;http://www.beasy.org/wp-content/uploads/2011/10/sh.jpg&#34;/&#62; &#60;/s:Group&#62; &#60;/s:Scroller&#62; &#60;/s:Application&#62; Demo的代码量是非常少的，关键的地方在Scroller的interactionMode样式上，interactionMode的值有两个可选：touch、mouse。interactionMode决定了Scroller的交互方式是鼠标操作还是触屏操作。 强大的Scroller内部已经做好了我们需要的功能，我们只需要设计相关的属性或样式即可。在桌面应用开发时interactionMode的值默认为mouse，在移动项目开发时interactionMode的值默认为touch。 所以我们在Flex移动项目里面使用List组件时发现它的滑动效果和iPhone的一模一样，其实这个都是Scroller大哥的功劳啊! 到此，拖拽缓动demo的功能已经完成了，是不是巨简单呢？但他长的实在太丑了，我们要给他美化一下，也就是给Scroller定制一套皮肤。 关于Flex4皮肤的制作方法这里不细说，我只给出皮肤的原码。 说到Scroller的皮肤，我这里要说一个完整的Scroller皮肤的组成部分: 首先是一个主skin文件，主skin包含横向和纵向两个滚动条. 横向和纵向滚动条都各自有自己的skin. 滚动条双包含：左/上移按钮、右/下移按钮、轨迹轴背景、滑动块这个四个部分. 以上每个部分的每个元素都可以各自去自定义自己的skin，以下是各个部分的skin: 1. 滚动条主体ScrollerSkin.mxml: &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:SparkSkin xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34;&#62; &#160; &#60;fx:Metadata&#62; &#60;![CDATA[ /** * @copy spark.skins.spark.ApplicationSkin#hostComponent */ [HostComponent(&#34;spark.components.Scroller&#34;)] ]]&#62; &#60;/fx:Metadata&#62; &#160; &#60;fx:Script&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>你有在做类似Google地图这种拖拽缓动效果的应用吗？你还在为写缓动加速算法而头痛吗？如果是那么你看了下面的文章内容后你肯定会大骂一句：“TMD，原来这么简单！”。。。</p>
<p>费话少说，先看一下效果吧(由于是国外服务器，flash和图片加载有点慢，有请耐心等待)：<br />
<object width="680" 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="allowScriptAcess" value="sameDomain" /><param name="quality" value="best" /><param name="scale" value="noScale" /><param name="menu" value="false" /><param name="wmode" value="opaque" /><param name="src" value="http://www.beasy.org/wp-content/uploads/2011/10/Drag1.swf" /><param name="allowscriptacess" value="sameDomain" /><embed width="680" height="500" type="application/x-shockwave-flash" src="http://www.beasy.org/wp-content/uploads/2011/10/Drag1.swf" allowScriptAcess="sameDomain" quality="best" scale="noScale" menu="false" wmode="opaque" allowscriptacess="sameDomain" /></object></p>
<p>效果怎么样，是不是很流畅呢！<br />
<span id="more-213"></span><br />
从Demo外表可以看出他是基于Flex的Scroller组件实现的，具体代码如下：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Application</span> <span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #009900;">			   <span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #009900;">			   <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Scroller</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">interactionMode</span>=<span style="color: #ff0000;">&quot;touch&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Group<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Image</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;http://www.beasy.org/wp-content/uploads/2011/10/sh.jpg&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Group<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Scroller<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>Demo的代码量是非常少的，关键的地方在Scroller的interactionMode样式上，interactionMode的值有两个可选：touch、mouse。interactionMode决定了Scroller的交互方式是鼠标操作还是触屏操作。</p>
<p>强大的Scroller内部已经做好了我们需要的功能，我们只需要设计相关的属性或样式即可。在桌面应用开发时interactionMode的值默认为mouse，在移动项目开发时interactionMode的值默认为touch。</p>
<p>所以我们在Flex移动项目里面使用List组件时发现它的滑动效果和iPhone的一模一样，其实这个都是Scroller大哥的功劳啊!</p>
<p>到此，拖拽缓动demo的功能已经完成了，是不是巨简单呢？但他长的实在太丑了，我们要给他美化一下，也就是给Scroller定制一套皮肤。</p>
<p>关于Flex4皮肤的制作方法这里不细说，我只给出皮肤的原码。</p>
<p>说到Scroller的皮肤，我这里要说一个完整的Scroller皮肤的组成部分:</p>
<ol>
<li><span style="color: #0000ff;">首先是一个主skin文件，主skin包含横向和纵向两个滚动条.</span></li>
<li><span style="color: #0000ff;">横向和纵向滚动条都各自有自己的skin.</span></li>
<li><span style="color: #0000ff;">滚动条双包含：左/上移按钮、右/下移按钮、轨迹轴背景、滑动块这个四个部分.</span></li>
</ol>
<p>以上每个部分的每个元素都可以各自去自定义自己的skin，以下是各个部分的skin:</p>
<p>1. 滚动条主体ScrollerSkin.mxml:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SparkSkin</span> <span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> <span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #339933;">&lt;![CDATA[ </span>
<span style="color: #339933;">        /** </span>
<span style="color: #339933;">         * @copy spark.skins.spark.ApplicationSkin#hostComponent</span>
<span style="color: #339933;">         */</span>
<span style="color: #339933;">        [HostComponent(&quot;spark.components.Scroller&quot;)]</span>
<span style="color: #339933;">    ]]&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
&nbsp;
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #339933;">&lt;![CDATA[    </span>
<span style="color: #339933;">        /**</span>
<span style="color: #339933;">         *  @private</span>
<span style="color: #339933;">         */</span>
<span style="color: #339933;">        override public function beginHighlightBitmapCapture() : Boolean</span>
<span style="color: #339933;">        {</span>
<span style="color: #339933;">            var needUpdate:Boolean = super.beginHighlightBitmapCapture();</span>
&nbsp;
<span style="color: #339933;">            // Draw an opaque rect that fill our entire skin. Our background</span>
<span style="color: #339933;">            // is transparent, but we don't want focus/error skins to</span>
<span style="color: #339933;">            // poke through.  This is safe to do since we don't have any </span>
<span style="color: #339933;">            // graphic elements as direct children.</span>
<span style="color: #339933;">            graphics.beginFill(0);</span>
<span style="color: #339933;">            graphics.drawRect(0, 0, width, height);</span>
<span style="color: #339933;">            graphics.endFill();</span>
&nbsp;
<span style="color: #339933;">            return needUpdate;</span>
<span style="color: #339933;">        }</span>
&nbsp;
<span style="color: #339933;">        /**</span>
<span style="color: #339933;">         *  @private</span>
<span style="color: #339933;">         */</span>
<span style="color: #339933;">        override public function endHighlightBitmapCapture() : Boolean</span>
<span style="color: #339933;">        {</span>
<span style="color: #339933;">            var needUpdate:Boolean = super.endHighlightBitmapCapture();</span>
&nbsp;
<span style="color: #339933;">            // Clear the rect we drew in beginBitmapCapture();</span>
<span style="color: #339933;">            graphics.clear();</span>
<span style="color: #339933;">            return needUpdate;</span>
<span style="color: #339933;">        }</span>
<span style="color: #339933;">    ]]&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:VScrollBar</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;verticalScrollBar&quot;</span> <span style="color: #000066;">visible</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">skinClass</span>=<span style="color: #ff0000;">&quot;skins.VScrollBarSkin&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:HScrollBar</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;horizontalScrollBar&quot;</span> <span style="color: #000066;">visible</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">skinClass</span>=<span style="color: #ff0000;">&quot;skins.HScrollBarSkin&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:SparkSkin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>2. 横向滚动条HScrollBarSkin.mxml(<span style="color: #ff6600;">因为使用拖动就不需要左右/上下移动的按扭了，所以这里皮肤把那两个按钮去掉了</span>):</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SparkSkin</span> <span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> <span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:fb</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/flashbuilder/2009&quot;</span> <span style="color: #000066;">minWidth</span>=<span style="color: #ff0000;">&quot;35&quot;</span> <span style="color: #000066;">minHeight</span>=<span style="color: #ff0000;">&quot;15&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">alpha.disabled</span>=<span style="color: #ff0000;">&quot;0.5&quot;</span> <span style="color: #000066;">alpha.inactive</span>=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #339933;">&lt;![CDATA[ </span>
<span style="color: #339933;">        /** </span>
<span style="color: #339933;">         * @copy spark.skins.spark.ApplicationSkin#hostComponent</span>
<span style="color: #339933;">         */</span>
<span style="color: #339933;">        [HostComponent(&quot;spark.components.HScrollBar&quot;)]</span>
<span style="color: #339933;">    ]]&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;normal&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;disabled&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;inactive&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;track&quot;</span> <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;10&quot;</span> </span>
<span style="color: #009900;">              <span style="color: #000066;">focusEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">tabEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">skinClass</span>=<span style="color: #ff0000;">&quot;skins.ScrollBarTrackSkin&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;thumb&quot;</span> </span>
<span style="color: #009900;">              <span style="color: #000066;">focusEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">visible.inactive</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">tabEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">mouseEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">skinClass</span>=<span style="color: #ff0000;">&quot;skins.ScrollBarThumbSkin&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
&nbsp;
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:SparkSkin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>3. 纵向的滚动条VScrollerSkin.mxml:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SparkSkin</span> <span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> <span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span></span>
<span style="color: #009900;">    <span style="color: #000066;">xmlns:fb</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/flashbuilder/2009&quot;</span> <span style="color: #000066;">minWidth</span>=<span style="color: #ff0000;">&quot;15&quot;</span> <span style="color: #000066;">minHeight</span>=<span style="color: #ff0000;">&quot;15&quot;</span> </span>
<span style="color: #009900;">    <span style="color: #000066;">alpha.disabled</span>=<span style="color: #ff0000;">&quot;0.5&quot;</span> <span style="color: #000066;">alpha.inactive</span>=<span style="color: #ff0000;">&quot;0.5&quot;</span> <span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #339933;">&lt;![CDATA[ </span>
<span style="color: #339933;">        /** </span>
<span style="color: #339933;">         * @copy spark.skins.spark.ApplicationSkin#hostComponent</span>
<span style="color: #339933;">         */</span>
<span style="color: #339933;">        [HostComponent(&quot;spark.components.VScrollBar&quot;)]</span>
<span style="color: #339933;">    ]]&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;normal&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;disabled&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;inactive&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;track&quot;</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;10&quot;</span> </span>
<span style="color: #009900;">			  <span style="color: #000066;">focusEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">tabEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">			  <span style="color: #000066;">skinClass</span>=<span style="color: #ff0000;">&quot;skins.ScrollBarTrackSkin&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;thumb&quot;</span> </span>
<span style="color: #009900;">			  <span style="color: #000066;">skinClass</span>=<span style="color: #ff0000;">&quot;skins.ScrollBarThumbSkin&quot;</span> <span style="color: #000066;">mouseEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span></span>
<span style="color: #009900;">              <span style="color: #000066;">focusEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">visible.inactive</span>=<span style="color: #ff0000;">&quot;false&quot;</span> <span style="color: #000066;">tabEnabled</span>=<span style="color: #ff0000;">&quot;false&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:SparkSkin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p><span style="color: #ff0000;">注意这里HScrollerSkin和VScrollerSkin中的trace和thumb按钮使用的都是同一个按扭，这个是因为我横向和纵向的滚动条都是一样的外观。</span><br />
4. 滚动条的轨迹ScrollerBarTrackSkin.mxml(这里轨迹没有显示任何东西，但是轨迹不能去掉，否则显示会出错，不知道为什么。)</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SparkButtonSkin</span> <span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">xmlns:fb</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/flashbuilder/2009&quot;</span></span>
<span style="color: #009900;">             <span style="color: #000066;">minWidth</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">minHeight</span>=<span style="color: #ff0000;">&quot;10&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">alpha.disabled</span>=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #339933;">&lt;![CDATA[ </span>
<span style="color: #339933;">        /** </span>
<span style="color: #339933;">         * @copy spark.skins.spark.ApplicationSkin#hostComponent</span>
<span style="color: #339933;">         */</span>
<span style="color: #339933;">        [HostComponent(&quot;spark.components.Button&quot;)]</span>
<span style="color: #339933;">        ]]&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;up&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;over&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;down&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;disabled&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Rect</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;0&quot;</span> <span style="color: #000066;">minWidth</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">minHeight</span>=<span style="color: #ff0000;">&quot;10&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Rect<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:SparkButtonSkin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>5. 滑动ScrollerThumbSkin.mxml:</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SparkButtonSkin</span> <span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">xmlns:fb</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/flashbuilder/2009&quot;</span></span>
<span style="color: #009900;">             <span style="color: #000066;">minWidth</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">minHeight</span>=<span style="color: #ff0000;">&quot;10&quot;</span> </span>
<span style="color: #009900;">             <span style="color: #000066;">alpha.disabled</span>=<span style="color: #ff0000;">&quot;0.5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #339933;">&lt;![CDATA[ </span>
<span style="color: #339933;">        /** </span>
<span style="color: #339933;">         * @copy spark.skins.spark.ApplicationSkin#hostComponent</span>
<span style="color: #339933;">         */</span>
<span style="color: #339933;">        [HostComponent(&quot;spark.components.Button&quot;)]</span>
<span style="color: #339933;">        ]]&gt;</span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Metadata<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;up&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;over&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;down&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
        <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:State</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;disabled&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:states<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
    <span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Rect</span> <span style="color: #000066;">top</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">left</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">right</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">bottom</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">radiusX</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">radiusY</span>=<span style="color: #ff0000;">&quot;5&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:fill<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SolidColor</span> <span style="color: #000066;">color</span>=<span style="color: #ff0000;">&quot;0xC0C0C0&quot;</span> <span style="color: #000066;">alpha</span>=<span style="color: #ff0000;">&quot;0.8&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:fill<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Rect<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:SparkButtonSkin<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>最后给Scroller加上skin：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Scroller</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">interactionMode</span>=<span style="color: #ff0000;">&quot;touch&quot;</span></span>
<span style="color: #009900;">				<span style="color: #000066;">skinClass</span>=<span style="color: #ff0000;">&quot;skins.ScrollerSkin&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span></pre></div></div>

<p>以下是加上皮肤后的效果：<br />
<object width="680" 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="allowScriptAcess" value="sameDomain" /><param name="quality" value="best" /><param name="scale" value="noScale" /><param name="menu" value="false" /><param name="wmode" value="opaque" /><param name="src" value="http://www.beasy.org/wp-content/uploads/2011/10/Drag2.swf" /><param name="allowscriptacess" value="sameDomain" /><embed width="680" height="500" type="application/x-shockwave-flash" src="http://www.beasy.org/wp-content/uploads/2011/10/Drag2.swf" allowScriptAcess="sameDomain" quality="best" scale="noScale" menu="false" wmode="opaque" allowscriptacess="sameDomain" /></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2011/10/flex4-drag-animation-easing/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Flash Player 11 &amp; AIR 3.0 新特性</title>
		<link>http://www.beasy.org/2011/08/flash-player-11-air-3-new-future/</link>
		<comments>http://www.beasy.org/2011/08/flash-player-11-air-3-new-future/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 10:40:16 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[行业资讯]]></category>
		<category><![CDATA[AIR3]]></category>
		<category><![CDATA[Flash Player 11]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=205</guid>
		<description><![CDATA[下一代Flash Player 11和AIR 3的关注领域为跨屏幕，也就是各种终端设备，包换：PC、笔记本、手机、游戏机(PSP)、电视机机顶盒等。 下一代Flash Runtimes新功能和增强主要分为以下七个部分： 1. 软件架构 在软件架构方面，下一代运行时支持64位操作系统(Windows、Mac、Linux)和64位浏览器。 2.桌面能力增强 1) WebKit升级 与Safari 5.0.5同步内核版本 支持更多的HTML5标签 Nitro JS引擎，提速30% PDF渲染加速 PNG Lib升级 XML/XSLT Lib升级 Cairo/Pixman Lib升级 2) Direct Mode AIR中使用GPU加速StageVideo与Stage3D 3) 运行时绑定 在打包AIR程序时可以把AIR Runtime也打包进去，只支持Windows和Mac系统。 使用场景: 企业或独立应用 防火墙内 无需频繁更新运行时 无管理员权限 4) 其他 JPEG-XR(俗称HD Photo)支持 高分辨率位图支持(取决于系统内存)，也就是不限制BitmapData的宽和高了。 LZMA高效压缩SWF，SWF的体积会更小。 3.虚假机及语言 1) GC开销建议pauseForGCIfCollectionImminent() 具体意义&#8211;借用Y.boy的解释:”这个函数并非让 flash player 立即进行垃圾回收，而是告诉 flash player 在什么时候应该停止垃圾收集。就是：告诉 Flash Player [...]]]></description>
			<content:encoded><![CDATA[<p>下一代Flash Player 11和AIR 3的关注领域为跨屏幕，也就是各种终端设备，包换：PC、笔记本、手机、游戏机(PSP)、电视机机顶盒等。</p>
<p>下一代Flash Runtimes新功能和增强主要分为以下七个部分：</p>
<h2>1. 软件架构</h2>
<p style="padding-left: 30px;">在软件架构方面，下一代运行时支持64位操作系统(Windows、Mac、Linux)和64位浏览器。</p>
<h2>2.桌面能力增强</h2>
<p style="padding-left: 30px;">1) WebKit升级</p>
<ol>
<ol>
<li>与Safari 5.0.5同步内核版本</li>
<li>支持更多的HTML5标签</li>
<li>Nitro JS引擎，提速30%</li>
<li>PDF渲染加速</li>
<li>PNG Lib升级</li>
<li>XML/XSLT Lib升级</li>
<li>Cairo/Pixman Lib升级</li>
</ol>
</ol>
<p style="padding-left: 30px;">2) Direct Mode</p>
<p style="padding-left: 60px;">AIR中使用GPU加速StageVideo与Stage3D</p>
<p style="padding-left: 30px;">3) 运行时绑定</p>
<address style="padding-left: 60px;">在打包AIR程序时可以把AIR Runtime也打包进去，只支持Windows和Mac系统。</address>
<p style="padding-left: 60px;">使用场景:</p>
<ol>
<ol>
<li>企业或独立应用</li>
<li>防火墙内</li>
<li>无需频繁更新运行时</li>
<li>无管理员权限</li>
</ol>
</ol>
<p style="padding-left: 30px;">4) 其他</p>
<ol>
<ol>
<li>JPEG-XR(俗称HD Photo)支持</li>
<li>高分辨率位图支持(取决于系统内存)，也就是不限制BitmapData的宽和高了。</li>
<li>LZMA高效压缩SWF，SWF的体积会更小。</li>
</ol>
</ol>
<p><span id="more-205"></span></p>
<h2>3.虚假机及语言</h2>
<p style="padding-left: 30px;">1) GC开销建议pauseForGCIfCollectionImminent()</p>
<p style="padding-left: 60px;">具体意义&#8211;借用Y.boy的解释:”这个函数并非让 flash player 立即进行垃圾回收，而是告诉 flash player 在什么时候应该停止垃圾收集。就是：告诉 Flash Player 垃圾回收的紧逼性（或叫频繁度）。参数 imminence 是一个范围为 0 到 1 的数。参数越靠近 1 ，垃圾回收越频繁，反之亦然。当垃圾回收器的紧逼系数大于参数值时，就停止垃圾收集。<strong>依然地，你还是不知道 flash player 在何时进行垃圾回收。</strong>“</p>
<p style="padding-left: 30px;">2) Socket 进程事件</p>
<ol>
<ol>
<li>新属性:Socket.bytesPending:unit</li>
<li>新事件:OutputProgressEvent.OUTPUT_PROGRESS</li>
</ol>
</ol>
<p style="padding-left: 30px;">3) 显示对象新API</p>
<ol>
<ol>
<li>DisplayObjectContainer.removeChildren();</li>
<li>MoveClip.isPlaying();</li>
</ol>
</ol>
<p style="padding-left: 30px;">4) 三次Bezier曲线</p>
<p style="padding-left: 60px;">两个控制点，可以画出更加圆滑的曲线。</p>
<p style="padding-left: 30px;">5) 内置JSON解析</p>
<p style="padding-left: 60px;">添加顶级类JSON，解析速度比第三方API提高一倍。</p>
<h2>4.媒体</h2>
<p style="padding-left: 30px;">1) G.711音频压缩</p>
<p style="padding-left: 60px;">可输出用于电话的音频格式</p>
<p style="padding-left: 30px;">2) H.264/AVC软编码支持</p>
<p style="padding-left: 60px;">Flash使用摄像扑捉H.264格式高清视频</p>
<h2>5.硬件与设备</h2>
<p style="padding-left: 30px;">1) Stage3D</p>
<p style="padding-left: 60px;">GPU加速(DirectX、OpenGL、OpenGL ES、SwiftShader)</p>
<p style="padding-left: 30px;">2) 支持系统文字输入功能</p>
<p style="padding-left: 60px;">支持移动设备(Android、iOS、BlackBerry)和的软键盘、放大镜、多选、语法检测。</p>
<p style="padding-left: 30px;">3) 前置摄像头支持</p>
<p style="padding-left: 30px;">4) 其它新功能</p>
<ol>
<ol>
<li>移动芯片视频硬解码优化TI、Samsung、Nvidia、Qualcomm</li>
<li>StageVideo硬件加速Android 3.1、BlackBerry Tablet OS、 iOS</li>
<li>设备音量控制AIR Android、iOS</li>
<li>Wacom Styuses触控设备支持</li>
<li>Android Honeycomb隐私浏览模式</li>
<li>Flash Access(DRM)for Mobile</li>
</ol>
</ol>
<h2>6.性能</h2>
<p style="padding-left: 30px;">1) Flex移动应用减少50%启动时间</p>
<p style="padding-left: 30px;">2) 异步位图解码，独立线程</p>
<p style="padding-left: 30px;">3) iOS硬件解码H.264</p>
<p style="padding-left: 30px;">4) Native JSON 2倍解析速度于第三方类库</p>
<p style="padding-left: 30px;">5) Android % iOS内存占用降低10%</p>
<p style="padding-left: 30px;">6) Stage3D+Flare3D, 1200万多边形</p>
<p>7.安全</p>
<p style="padding-left: 30px;">1) 随机加密数字生成器</p>
<p style="padding-left: 30px;">2) TLS(Transport Layer Security) sockets</p>
<p style="padding-left: 30px;">3) TLS socket 策略文件</p>
<p style="padding-left: 30px;">4) 支持Android Honeycomb私密浏览模式</p>
<p style="padding-left: 30px;">5) 移动设备加密本地存储</p>
<p style="padding-left: 30px;">
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2011/08/flash-player-11-air-3-new-future/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Fex4中使用Group实现滑动翻页</title>
		<link>http://www.beasy.org/2011/06/fex4-group-feature/</link>
		<comments>http://www.beasy.org/2011/06/fex4-group-feature/#comments</comments>
		<pubDate>Sat, 25 Jun 2011 16:56:49 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[生活随笔]]></category>
		<category><![CDATA[Animate]]></category>
		<category><![CDATA[Flex4]]></category>
		<category><![CDATA[Group]]></category>
		<category><![CDATA[Scroller]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=197</guid>
		<description><![CDATA[在Flex4中Group取代了flex3时代的Canvas和Box容器，成为了主要的布局容器，相比Canvas和Box她更加轻量，因为至少Group中没有实现滚动条的代码。 现在这个例子展示了用Group配合Animate实现分页，并且实现翻页的动画： &#60;?xml version=&#34;1.0&#34; encoding=&#34;utf-8&#34;?&#62; &#60;s:Application xmlns:fx=&#34;http://ns.adobe.com/mxml/2009&#34; xmlns:s=&#34;library://ns.adobe.com/flex/spark&#34; xmlns:mx=&#34;library://ns.adobe.com/flex/mx&#34; minWidth=&#34;955&#34; minHeight=&#34;600&#34;&#62; &#60;fx:Script&#62; &#60;![CDATA[ import spark.core.NavigationUnit; &#160; /** * 上一页 */ private function prePageHandler():void { smp.valueBy = hGroup.getHorizontalScrollPositionDelta(NavigationUnit.PAGE_LEFT); anmiate.play(); } &#160; /** * 下一页 */ private function nextPageHandler():void { smp.valueBy = hGroup.getHorizontalScrollPositionDelta(NavigationUnit.PAGE_RIGHT); anmiate.play(); } &#160; ]]&#62; &#60;/fx:Script&#62; &#60;fx:Declarations&#62; &#60;s:Animate id=&#34;anmiate&#34; target=&#34;{hGroup}&#34; duration=&#34;800&#34;&#62; &#60;s:motionPaths&#62; &#60;s:SimpleMotionPath id=&#34;smp&#34; property=&#34;horizontalScrollPosition&#34;/&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>在Flex4中Group取代了flex3时代的Canvas和Box容器，成为了主要的布局容器，相比Canvas和Box她更加轻量，因为至少Group中没有实现滚动条的代码。<br />
现在这个例子展示了用Group配合Animate实现分页，并且实现翻页的动画：</p>

<div class="wp_syntax"><div class="code"><pre class="xml" style="font-family:monospace;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;utf-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Application</span> <span style="color: #000066;">xmlns:fx</span>=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #009900;">			   <span style="color: #000066;">xmlns:s</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #009900;">			   <span style="color: #000066;">xmlns:mx</span>=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/mx&quot;</span> </span>
<span style="color: #009900;">			   <span style="color: #000066;">minWidth</span>=<span style="color: #ff0000;">&quot;955&quot;</span> <span style="color: #000066;">minHeight</span>=<span style="color: #ff0000;">&quot;600&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #339933;">&lt;![CDATA[</span>
<span style="color: #339933;">		import spark.core.NavigationUnit;</span>
&nbsp;
<span style="color: #339933;">		/**</span>
<span style="color: #339933;">		 * 上一页</span>
<span style="color: #339933;">		 */</span>
<span style="color: #339933;">		private function prePageHandler():void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			smp.valueBy = hGroup.getHorizontalScrollPositionDelta(NavigationUnit.PAGE_LEFT);</span>
<span style="color: #339933;">			anmiate.play();</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		/**</span>
<span style="color: #339933;">		 * 下一页</span>
<span style="color: #339933;">		 */</span>
<span style="color: #339933;">		private function nextPageHandler():void</span>
<span style="color: #339933;">		{</span>
<span style="color: #339933;">			smp.valueBy = hGroup.getHorizontalScrollPositionDelta(NavigationUnit.PAGE_RIGHT);</span>
<span style="color: #339933;">			anmiate.play();</span>
<span style="color: #339933;">		}</span>
&nbsp;
<span style="color: #339933;">		]]&gt;</span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Script<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;fx:Declarations<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Animate</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;anmiate&quot;</span> <span style="color: #000066;">target</span>=<span style="color: #ff0000;">&quot;{hGroup}&quot;</span> <span style="color: #000066;">duration</span>=<span style="color: #ff0000;">&quot;800&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:motionPaths<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:SimpleMotionPath</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;smp&quot;</span> <span style="color: #000066;">property</span>=<span style="color: #ff0000;">&quot;horizontalScrollPosition&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:motionPaths<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Animate<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/fx:Declarations<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Panel</span> <span style="color: #000066;">title</span>=<span style="color: #ff0000;">&quot;Flex4 Group新特性&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:HGroup</span> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;hGroup&quot;</span> <span style="color: #000066;">gap</span>=<span style="color: #ff0000;">&quot;10&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;320&quot;</span> <span style="color: #000066;">clipAndEnableScrolling</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;2&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;3&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;4&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;5&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;6&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">height</span>=<span style="color: #ff0000;">&quot;100&quot;</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;7&quot;</span> <span style="color: #000066;">fontSize</span>=<span style="color: #ff0000;">&quot;30&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:HGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:controlBarContent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:HGroup</span> <span style="color: #000066;">width</span>=<span style="color: #ff0000;">&quot;100%&quot;</span> <span style="color: #000066;">horizontalAlign</span>=<span style="color: #ff0000;">&quot;center&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;上一页&quot;</span> <span style="color: #000066;">click</span>=<span style="color: #ff0000;">&quot;prePageHandler()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
				<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;s:Button</span> <span style="color: #000066;">label</span>=<span style="color: #ff0000;">&quot;下一页&quot;</span> <span style="color: #000066;">click</span>=<span style="color: #ff0000;">&quot;nextPageHandler()&quot;</span><span style="color: #000000; font-weight: bold;">/&gt;</span></span>
			<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:HGroup<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
		<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:controlBarContent<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
	<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Panel<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/s:Application<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></div></div>

<p>使用motionPaths属于Animate可以同时设置目标的多个属于以实现更加复杂的动画，在这里我们只要改变Group的<b>horizontalScrollPosition</b>即可，因为在Group容器在不能把子集全部显示出来的时候，horizontalScrollPosition和verticalScrollPosition会自动计算出来，这个两个属性是给Scroller用的。<br />
最灵活最巧妙的地方就是这两属性不光可以做为滚动条使用，可以通过Animate改变其值，实现滑动的效果。<br />
<b>NavigationUnit</b>是一个枚举类，他定义了PAGE_UP、PAGE_DOWN、PAGE_LEFT、PAGE_RIGHT等等，这里我们用了HGroup，是横向的，所以只用PAGE_LEFT,PAGE_RIGHT就可以了，还有一点非常重要，那就是Group的两个方法:<b>getHorizontalScrollPositionDelta()</b>和<b>getVerticalScrollPositionDelta()</b>，使用这个两个人方法和NavigationUnit枚举类的参数，可以计算出左移或者右移当前页时，所需要调整的horizontalScrollPosition值。以此类推，可以使用VGroup实现上下的翻页，TileGroup可以实现上下左右的翻动，而且修改起来非常简单。<br />
就是这样，计算出滚动距离传给SimpleMotionPath 然后播放动画，一切就是这么简单，而且效率极高。</p>
<p><a href='http://www.beasy.org/wp-content/uploads/2011/06/Flex4Features.swf'>点击查看效果</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2011/06/fex4-group-feature/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex4中[Client.Error.DeliveryInDoubt]错误经验一例</title>
		<link>http://www.beasy.org/2011/02/flex-client-error-deliveryindoubt/</link>
		<comments>http://www.beasy.org/2011/02/flex-client-error-deliveryindoubt/#comments</comments>
		<pubDate>Sat, 12 Feb 2011 02:39:59 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[生活随笔]]></category>
		<category><![CDATA[Error]]></category>
		<category><![CDATA[Flex4]]></category>
		<category><![CDATA[RemoteObject]]></category>
		<category><![CDATA[RTMP]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=192</guid>
		<description><![CDATA[最近遇到一个很奇怪的问题，我在使用RemoteObject调用后台.net rpc服务时老是报一个错:[faultCode:Client.Error.DeliveryInDoubt faultString:'通道已断开' faultDetail:'收到确认前通道已断开']。 把自己的代码查询了半天也找不出任何问题，后来还是调试.net代码的时候找到点眉目，原来.net接口本来应该返回给我视频文件路径的，它却把视频文件的整个二进制流读出来一下子返回给我了。我的RemoteObject是使用的RTMP通道，四个视频文件一共40MB，可能RTMP不支持这么大的数量，导致在传输过程中崩溃了！ 希望我的教训对大家有用，在这里祝朋友们新年快乐，大吉大利！]]></description>
			<content:encoded><![CDATA[<p>最近遇到一个很奇怪的问题，我在使用RemoteObject调用后台.net rpc服务时老是报一个错:[faultCode:Client.Error.DeliveryInDoubt faultString:'通道已断开' faultDetail:'收到确认前通道已断开']。</p>
<p>把自己的代码查询了半天也找不出任何问题，后来还是调试.net代码的时候找到点眉目，原来.net接口本来应该返回给我视频文件路径的，它却把视频文件的整个二进制流读出来一下子返回给我了。我的RemoteObject是使用的RTMP通道，四个视频文件一共40MB，可能RTMP不支持这么大的数量，导致在传输过程中崩溃了！</p>
<p>希望我的教训对大家有用，在这里祝朋友们新年快乐，大吉大利！</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2011/02/flex-client-error-deliveryindoubt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flex里的空闲检测-IDLE</title>
		<link>http://www.beasy.org/2010/12/flex-idle/</link>
		<comments>http://www.beasy.org/2010/12/flex-idle/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 08:14:20 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[生活随笔]]></category>
		<category><![CDATA[flex]]></category>
		<category><![CDATA[idle]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=162</guid>
		<description><![CDATA[Flex里面也有空闲检测，本来为了实现这个功能还要去全局侦听鼠标和键盘事件，有了IDLE这下可方便多了。 IDLE由SystemManager进行管理，所以要检测IDLE就要对SystemManager进行侦听，方法如下： /** * 主程序初始化时对systemManager进行侦听 */ public function init&#40;&#41;:void &#123; systemManager.addEventListener&#40;FlexEvent.IDLE, idleHandler&#41;; &#125; &#160; /** * idle事件处理 */ private function idleHandler&#40;event:FlexEvent&#41;:void &#123; var idleCounter:int = systemManager.mx_internal::idleCounter; if&#40; idleCounter &#62;= 900&#41;// 100毫秒一次，900就等于90秒 systmeIdle&#40;&#41;; &#125; &#160; /** * 发送系统空闲消息 */ private function systmeIdle&#40;&#41;:void &#123; // TO DO ... &#125; 这里要注意的是FlexEvent.IDLE事件派发规则是:当 1 秒内没有任何键盘和鼠标活动时，每隔 100 毫秒分派一次。 根据API所知，我们不能去设定系统空闲多少秒以后才派发IDLE事件，这里我们只能在idleHandler事件处理方法里面根据systemManager对IDLE事件派发的次数来计算系统已经空闲了多长时间，悲剧的这个事件的派发次数还被隐藏起来了，在mx_internal命名空间下，如果要得到这个值我们不得不使用mx_internal这个命名空间，莫名其妙的多走了一步，方法如下： // 先把名导入 [...]]]></description>
			<content:encoded><![CDATA[<p>Flex里面也有空闲检测，本来为了实现这个功能还要去全局侦听鼠标和键盘事件，有了IDLE这下可方便多了。<br />
IDLE由SystemManager进行管理，所以要检测IDLE就要对SystemManager进行侦听，方法如下：</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #3f5fbf;">/**
 * 主程序初始化时对systemManager进行侦听
 */</span>
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #004993;">init</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	systemManager<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span>FlexEvent<span style="color: #000066; font-weight: bold;">.</span>IDLE<span style="color: #000066; font-weight: bold;">,</span> idleHandler<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * idle事件处理
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> idleHandler<span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:</span>FlexEvent<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #6699cc; font-weight: bold;">var</span> idleCounter<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = systemManager<span style="color: #000066; font-weight: bold;">.</span>mx_internal<span style="color: #000066; font-weight: bold;">::</span>idleCounter<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> idleCounter <span style="color: #000066; font-weight: bold;">&gt;</span>= <span style="color: #000000; font-weight:bold;">900</span><span style="color: #000000;">&#41;</span><span style="color: #009900; font-style: italic;">// 100毫秒一次，900就等于90秒</span>
		systmeIdle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
<span style="color: #000000;">&#125;</span>
&nbsp;
<span style="color: #3f5fbf;">/**
 * 发送系统空闲消息
 */</span>
<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> systmeIdle<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
<span style="color: #000000;">&#123;</span>
	<span style="color: #009900; font-style: italic;">// TO DO ...</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>这里要注意的是FlexEvent.IDLE事件派发规则是:<b>当 1 秒内没有任何键盘和鼠标活动时，每隔 100 毫秒分派一次</b>。<br />
根据API所知，我们不能去设定系统空闲多少秒以后才派发IDLE事件，这里我们只能在idleHandler事件处理方法里面根据systemManager对IDLE事件派发的次数来计算系统已经空闲了多长时间，悲剧的这个事件的派发次数还被隐藏起来了，在mx_internal命名空间下，如果要得到这个值我们不得不使用mx_internal这个命名空间，莫名其妙的多走了一步，方法如下：</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #009900; font-style: italic;">// 先把名导入</span>
<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>core<span style="color: #000066; font-weight: bold;">.</span>mx_internal<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
<span style="color: #009900; font-style: italic;">// 对象.命名空间::属性名</span>
systemManager<span style="color: #000066; font-weight: bold;">.</span>mx_internal<span style="color: #000066; font-weight: bold;">::</span>idleCounter<span style="color: #000066; font-weight: bold;">;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2010/12/flex-idle/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Flash Builder 4安装程序采用AIR技术</title>
		<link>http://www.beasy.org/2010/03/flex-builder-4-install-air/</link>
		<comments>http://www.beasy.org/2010/03/flex-builder-4-install-air/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 06:17:37 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[原创文章]]></category>
		<category><![CDATA[行业资讯]]></category>
		<category><![CDATA[air]]></category>
		<category><![CDATA[FlashBuilder]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=156</guid>
		<description><![CDATA[刚刚在安装新下载的Flash Builder4正式版,从整个安装向导UI来看极像是用AIR程序做的。 AIR2.0已经支持将程序打包为可直接执行的exe文件。 安装向导用AIR2.0解决方案，即能体现AIR2.0的特性又给自己的产品做了一次值入式广告，真是一举两得!]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.beasy.org/wp-content/uploads/2010/03/flex4.jpg"><img class="size-full wp-image-157 alignnone" title="flex4" src="http://www.beasy.org/wp-content/uploads/2010/03/flex4.jpg" alt="" width="815" height="552" /></a></p>
<p>刚刚在安装新下载的Flash Builder4正式版,从整个安装向导UI来看极像是用AIR程序做的。</p>
<p>AIR2.0已经支持将程序打包为可直接执行的exe文件。</p>
<p>安装向导用AIR2.0解决方案，即能体现AIR2.0的特性又给自己的产品做了一次值入式广告，真是一举两得!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2010/03/flex-builder-4-install-air/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flash Builder 4 正式版发布</title>
		<link>http://www.beasy.org/2010/03/flash-builder-4-publish/</link>
		<comments>http://www.beasy.org/2010/03/flash-builder-4-publish/#comments</comments>
		<pubDate>Mon, 22 Mar 2010 04:39:55 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[行业资讯]]></category>
		<category><![CDATA[FlashBuilder]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=153</guid>
		<description><![CDATA[千呼万唤始出来,期盼已久的Flash Builder4 正式版今天终于发布了。 我也在下载中，希望会有令人心动的改进。 点击这里下载。]]></description>
			<content:encoded><![CDATA[<p>千呼万唤始出来,期盼已久的Flash Builder4 正式版今天终于发布了。<br />
我也在下载中，希望会有令人心动的改进。<br />
点击<a href="http://www.adobe.com/cfusion/tdrc/index.cfm?product=flash_builder">这里</a>下载。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2010/03/flash-builder-4-publish/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Hello Buzz!</title>
		<link>http://www.beasy.org/2010/02/hello-buzz/</link>
		<comments>http://www.beasy.org/2010/02/hello-buzz/#comments</comments>
		<pubDate>Wed, 10 Feb 2010 17:11:45 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[生活随笔]]></category>
		<category><![CDATA[精品收藏]]></category>
		<category><![CDATA[Buzz]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=138</guid>
		<description><![CDATA[Google今天发布一款名为Google Buzz的新产品，用户将可以直接在Gmail内分享信息、连接和照片。谷歌另外还发布了一系列用于Android智能手机的新型社交网络功能。 Buzz类型是Twitter的一个社交平台，信息实时推送。试用一个小时感觉非常不错，总体上继承了Gmail的优良血统，信息会自动保存在Gmail里面以免漏读，可以把信息打上喜欢的标签，共享Picasa, Google Reader, Flickr, Twitter上的内容，还可以对消息记录打包做为邮件发送。 担心! 继Facebook, Twitter, YouTube之后， Buzz会不会也只能在我们眼前昙花一现？]]></description>
			<content:encoded><![CDATA[<p>Google今天发布一款名为Google Buzz的新产品，用户将可以直接在Gmail内分享信息、连接和照片。谷歌另外还发布了一系列用于Android智能手机的新型社交网络功能。</p>
<p>Buzz类型是Twitter的一个社交平台，信息实时推送。试用一个小时感觉非常不错，总体上继承了Gmail的优良血统，信息会自动保存在Gmail里面以免漏读，可以把信息打上喜欢的标签，共享Picasa, Google Reader, Flickr, Twitter上的内容，还可以对消息记录打包做为邮件发送。<br />
<a href="http://www.beasy.org/wp-content/uploads/2010/02/buzz.png"><img src="http://www.beasy.org/wp-content/uploads/2010/02/buzz.png" alt="" title="buzz" width="303" height="261" class="alignnone size-full wp-image-140" /></a><br />
担心! 继Facebook, Twitter, YouTube之后， Buzz会不会也只能在我们眼前昙花一现？</p>
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2010/02/hello-buzz/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>自定义图表刻度标签</title>
		<link>http://www.beasy.org/2010/01/custom-axis-label/</link>
		<comments>http://www.beasy.org/2010/01/custom-axis-label/#comments</comments>
		<pubDate>Wed, 06 Jan 2010 15:22:55 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[原创文章]]></category>
		<category><![CDATA[axis]]></category>
		<category><![CDATA[chart]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=113</guid>
		<description><![CDATA[Flex为我们提供了一套非常强大的图表组件，而且这些组件给我们开发人员提供了丰富的接口，在此基础上可以扩展出更加令人兴奋的应用。 下面是我扩展的AxisRenderer类，AxisRenderer是图表轴渲染器，所有图表的轴都是通过这个类来渲染的。而我这个例子所做就是在AxisRenderer的基础上提供几个接口(以Style方式)，这几个接口的作用是给轴的刻度标签加上格式、前/后缀、千位符、单位。 Demo AxisRendererPlus继承自mx.charts.AxisRenderer package org.beasy.charts &#123; import mx.charts.AxisRenderer; import mx.charts.LinearAxis; import mx.charts.chartClasses.IAxisRenderer; import mx.formatters.NumberFormatter; &#160; /** * 是否显示千位符 * * @default false */ &#91;Style&#40;name=&#34;useThousandsSeparator&#34;, type=&#34;Boolean&#34;, inherit=&#34;no&#34;&#41;&#93; &#160; /** * 保留小数点位数 * * @default 0 */ &#91;Style&#40;name=&#34;precision&#34;, type=&#34;int&#34;, format=&#34;Length&#34;, inherit=&#34;no&#34;&#41;&#93; &#160; /** * 前缀 * * @param null */ &#91;Style&#40;name=&#34;prefix&#34;, type=&#34;String&#34;, inherit=&#34;no&#34;&#41;&#93; &#160; /** * [...]]]></description>
			<content:encoded><![CDATA[<p>Flex为我们提供了一套非常强大的图表组件，而且这些组件给我们开发人员提供了丰富的接口，在此基础上可以扩展出更加令人兴奋的应用。<br />
下面是我扩展的AxisRenderer类，AxisRenderer是图表轴渲染器，所有图表的轴都是通过这个类来渲染的。而我这个例子所做就是在AxisRenderer的基础上提供几个接口(以Style方式)，这几个接口的作用是给轴的刻度标签加上格式、前/后缀、千位符、单位。</p>
<p><a href="http://www.beasy.org/wp-content/uploads/2010/01/CustomLinearAxisLabelsFormat1.swf" target="_blank">Demo</a></p>
<p><a href="http://www.beasy.org/wp-content/uploads/2010/01/labelFormat.png"><img src="http://www.beasy.org/wp-content/uploads/2010/01/labelFormat.png" alt="" title="labelFormat" width="526" height="525" class="alignnone size-full wp-image-128" /></a><br />
<span id="more-113"></span></p>
<p>AxisRendererPlus继承自mx.charts.AxisRenderer</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>beasy<span style="color: #000066; font-weight: bold;">.</span>charts
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>charts<span style="color: #000066; font-weight: bold;">.</span>AxisRenderer<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>charts<span style="color: #000066; font-weight: bold;">.</span>LinearAxis<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>charts<span style="color: #000066; font-weight: bold;">.</span>chartClasses<span style="color: #000066; font-weight: bold;">.</span>IAxisRenderer<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>formatters<span style="color: #000066; font-weight: bold;">.</span>NumberFormatter<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * 是否显示千位符
	 * 
	 * @default false
	 */</span>
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;useThousandsSeparator&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;Boolean&quot;</span><span style="color: #000066; font-weight: bold;">,</span> inherit=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * 保留小数点位数
	 * 
	 * @default 0
	 */</span>	
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;precision&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;int&quot;</span><span style="color: #000066; font-weight: bold;">,</span> format=<span style="color: #990000;">&quot;Length&quot;</span><span style="color: #000066; font-weight: bold;">,</span> inherit=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * 前缀
	 * 
	 * @param null
	 */</span>	
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;prefix&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;String&quot;</span><span style="color: #000066; font-weight: bold;">,</span> inherit=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * 后缀
	 * 
	 *@default null 
	 */</span>	
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;suffix&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;String&quot;</span><span style="color: #000066; font-weight: bold;">,</span> inherit=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * 货币单位
	 * 
	 * @param value
	 */</span>	
	<span style="color: #000000;">&#91;</span>Style<span style="color: #000000;">&#40;</span><span style="color: #004993;">name</span>=<span style="color: #990000;">&quot;moneyUnit&quot;</span><span style="color: #000066; font-weight: bold;">,</span> <span style="color: #004993;">type</span>=<span style="color: #990000;">&quot;com.beasy.charts.MoneyUnits&quot;</span><span style="color: #000066; font-weight: bold;">,</span> inherit=<span style="color: #990000;">&quot;no&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * 扩展过的AxisRendererPlus
	 * 支持定义标签格式:
	 * 1,支持千们符
	 * 2,小数点保留位数
	 * 3,前缀
	 * 4,后缀
	 * 5,大数字单位缩写
	 * 
	 * @author Marco
	 */</span>	
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> AxisRendererPlus <span style="color: #0033ff; font-weight: bold;">extends</span> AxisRenderer
	<span style="color: #000000;">&#123;</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//  Constructor</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> AxisRendererPlus<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			labelFunction = myLabelFunction<span style="color: #000066; font-weight: bold;">;</span>
			numberFmt = <span style="color: #0033ff; font-weight: bold;">new</span> NumberFormatter<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//  Variables</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * @private
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> numberFmt<span style="color: #000066; font-weight: bold;">:</span>NumberFormatter<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//  Methods</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * @private
		 * 
		 * 根据设定的样式值在labelFunction中转换显示的标签.
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> myLabelFunction<span style="color: #000000;">&#40;</span>axisRenderer<span style="color: #000066; font-weight: bold;">:</span>IAxisRenderer<span style="color: #000066; font-weight: bold;">,</span> label<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> useThousandsSeparator<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;useThousandsSeparator&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> precision<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;precision&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">prefix</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;prefix&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> suffix<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;suffix&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> moneyUnit<span style="color: #000066; font-weight: bold;">:</span>MoneyUnits = <span style="color: #004993;">getStyle</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;moneyUnit&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> axisRenderer<span style="color: #000066; font-weight: bold;">.</span>axis <span style="color: #0033ff; font-weight: bold;">is</span> LinearAxis <span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> num<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #004993;">Number</span><span style="color: #000000;">&#40;</span> label <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> moneyUnit <span style="color: #000000;">&#41;</span>
					num = MoneyUnits<span style="color: #000066; font-weight: bold;">.</span>formatByUnit<span style="color: #000000;">&#40;</span>moneyUnit<span style="color: #000066; font-weight: bold;">.</span>unit<span style="color: #000066; font-weight: bold;">,</span> num<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				numberFmt<span style="color: #000066; font-weight: bold;">.</span>precision = precision<span style="color: #000066; font-weight: bold;">;</span>
				numberFmt<span style="color: #000066; font-weight: bold;">.</span>useThousandsSeparator = useThousandsSeparator<span style="color: #000066; font-weight: bold;">;</span>
				label = numberFmt<span style="color: #000066; font-weight: bold;">.</span>format<span style="color: #000000;">&#40;</span>num<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> <span style="color: #004993;">prefix</span> <span style="color: #000000;">&#41;</span>
					label = <span style="color: #004993;">prefix</span><span style="color: #000066; font-weight: bold;">+</span>label<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> moneyUnit <span style="color: #000066; font-weight: bold;">&amp;&amp;</span> moneyUnit<span style="color: #000066; font-weight: bold;">.</span>unit <span style="color: #000066; font-weight: bold;">!</span>= MoneyUnits<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">NONE</span> <span style="color: #000000;">&#41;</span>
					label <span style="color: #000066; font-weight: bold;">+</span>= moneyUnit<span style="color: #000066; font-weight: bold;">.</span>label<span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span> suffix <span style="color: #000000;">&#41;</span>
					label <span style="color: #000066; font-weight: bold;">+</span>= suffix<span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> label<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>单位实体类MoneyUnits.as:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>beasy<span style="color: #000066; font-weight: bold;">.</span>charts
<span style="color: #000000;">&#123;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * 货币单位对象
	 * 
	 * @author Marco
	 */</span>	
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MoneyUnits
	<span style="color: #000000;">&#123;</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//  Class constants</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 原始单位
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static const <span style="color: #004993;">NONE</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;none&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 百
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static const HUNDRED<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;hundred&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 千
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static const THOUSAND<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;thousand&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 万
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static const TEN_THOUSAND<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;TEN_THOUSAND&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 十万
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static const LAKH<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;lakh&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 百万
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static const MILLION<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;million&quot;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//  Constructor</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MoneyUnits<span style="color: #000000;">&#40;</span> label<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> unit<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">super</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			_label = label<span style="color: #000066; font-weight: bold;">;</span>
			_unit = unit<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//  Properties</span>
		<span style="color: #009900; font-style: italic;">//</span>
		<span style="color: #009900; font-style: italic;">//--------------------------------------------------------------------------</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * @private
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _label<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * @private
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _unit<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 单位所对应的标签:百,千,万...
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> label<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			_label = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> label<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> _label<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * 要转换的单位:HUNDRED，THOUSAND，TEN_THOUSAND...
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">set</span> unit<span style="color: #000000;">&#40;</span><span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
		<span style="color: #000000;">&#123;</span>
			_unit = <span style="color: #004993;">value</span><span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> <span style="color: #0033ff; font-weight: bold;">get</span> unit<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> _unit<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #3f5fbf;">/**
		 * @private
		 * 
		 * 根据代币单位计算
		 */</span>		
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> formatByUnit<span style="color: #000000;">&#40;</span> unitStr<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span> num<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span> <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Number</span>
		<span style="color: #000000;">&#123;</span>
			<span style="color: #0033ff; font-weight: bold;">switch</span><span style="color: #000000;">&#40;</span> unitStr <span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #0033ff; font-weight: bold;">case</span> MoneyUnits<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">NONE</span> <span style="color: #000066; font-weight: bold;">:</span>
					<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">case</span> MoneyUnits<span style="color: #000066; font-weight: bold;">.</span>HUNDRED <span style="color: #000066; font-weight: bold;">:</span>
					num <span style="color: #000066; font-weight: bold;">/</span>= <span style="color: #000000; font-weight:bold;">100</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">case</span> MoneyUnits<span style="color: #000066; font-weight: bold;">.</span>THOUSAND <span style="color: #000066; font-weight: bold;">:</span>
					num <span style="color: #000066; font-weight: bold;">/</span>= <span style="color: #000000; font-weight:bold;">1000</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">case</span> MoneyUnits<span style="color: #000066; font-weight: bold;">.</span>TEN_THOUSAND <span style="color: #000066; font-weight: bold;">:</span>
					num <span style="color: #000066; font-weight: bold;">/</span>= <span style="color: #000000; font-weight:bold;">10000</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">case</span> MoneyUnits<span style="color: #000066; font-weight: bold;">.</span>LAKH <span style="color: #000066; font-weight: bold;">:</span>
					num <span style="color: #000066; font-weight: bold;">/</span>= <span style="color: #000000; font-weight:bold;">100000</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">case</span> MoneyUnits<span style="color: #000066; font-weight: bold;">.</span>MILLION <span style="color: #000066; font-weight: bold;">:</span>
					num <span style="color: #000066; font-weight: bold;">/</span>= <span style="color: #000000; font-weight:bold;">1000000</span><span style="color: #000066; font-weight: bold;">;</span>
					<span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
				<span style="color: #0033ff; font-weight: bold;">default</span> <span style="color: #000066; font-weight: bold;">:</span> <span style="color: #0033ff; font-weight: bold;">break</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
			<span style="color: #0033ff; font-weight: bold;">return</span> num<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>测试页面CustomLinearAxisLabelsFormat.mxml:</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">			   xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #000000;">			   xmlns:charts=<span style="color: #ff0000;">&quot;org.beasy.charts.*&quot;</span></span>
<span style="color: #000000;">			   xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span> minWidth=<span style="color: #ff0000;">&quot;1024&quot;</span> minHeight=<span style="color: #ff0000;">&quot;768&quot;</span> fontSize=<span style="color: #ff0000;">&quot;12&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:BasicLayout</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import mx.collections.ArrayCollection;</span>
&nbsp;
<span style="color: #000000;">			<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span></span>
<span style="color: #000000;">			public var dataSource:ArrayCollection = new ArrayCollection<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#123;</span> Country: <span style="color: #ff0000;">&quot;USA&quot;</span>, Gold: <span style="color: #cc66cc;">3500</span>, Silver:<span style="color: #cc66cc;">3900</span>, Bronze: <span style="color: #cc66cc;">2900</span> <span style="color: #66cc66;">&#125;</span>,</span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#123;</span> Country: <span style="color: #ff0000;">&quot;China&quot;</span>, Gold: <span style="color: #cc66cc;">3200</span>, Silver:<span style="color: #cc66cc;">1700</span>, Bronze: <span style="color: #cc66cc;">1400</span> <span style="color: #66cc66;">&#125;</span>,</span>
<span style="color: #000000;">				<span style="color: #66cc66;">&#123;</span> Country: <span style="color: #ff0000;">&quot;Russia&quot;</span>, Gold: <span style="color: #cc66cc;">2700</span>, Silver:<span style="color: #cc66cc;">2700</span>, Bronze: <span style="color: #cc66cc;">3800</span> <span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Panel</span> title=<span style="color: #ff0000;">&quot;图表轴标签自定义格式测试&quot;</span> width=<span style="color: #ff0000;">&quot;500&quot;</span> height=<span style="color: #ff0000;">&quot;500&quot;</span> left=<span style="color: #ff0000;">&quot;20&quot;</span> top=<span style="color: #ff0000;">&quot;20&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:layout</span><span style="color: #7400FF;">&gt;</span><span style="color: #7400FF;">&lt;s:VerticalLayout</span><span style="color: #7400FF;">/&gt;</span><span style="color: #7400FF;">&lt;/s:layout</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColumnChart</span> id=<span style="color: #ff0000;">&quot;columnChart&quot;</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span> height=<span style="color: #ff0000;">&quot;100%&quot;</span> dataProvider=<span style="color: #ff0000;">&quot;{dataSource}&quot;</span> showDataTips=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:verticalAxisRenderers</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;charts:AxisRendererPlus</span> id=<span style="color: #ff0000;">&quot;axisRenderer&quot;</span> fontSize=<span style="color: #ff0000;">&quot;12&quot;</span></span>
<span style="color: #000000;">										 useThousandsSeparator=<span style="color: #ff0000;">&quot;{thousandsSeparator.selected}&quot;</span></span>
<span style="color: #000000;">										 precision=<span style="color: #ff0000;">&quot;{precision.value}&quot;</span></span>
<span style="color: #000000;">										 prefix=<span style="color: #ff0000;">&quot;{prefix.text}&quot;</span></span>
<span style="color: #000000;">										 suffix=<span style="color: #ff0000;">&quot;{suffix.text}&quot;</span></span>
<span style="color: #000000;">										 moneyUnit=<span style="color: #ff0000;">&quot;{moneyUnits.selectedItem}&quot;</span><span style="color: #7400FF;">&gt;</span></span>
					<span style="color: #000000;"><span style="color: #7400FF;">&lt;charts:axis</span><span style="color: #7400FF;">&gt;</span></span>
						<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:LinearAxis</span> id=<span style="color: #ff0000;">&quot;vAxis&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
					<span style="color: #000000;"><span style="color: #7400FF;">&lt;/charts:axis</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;/charts:AxisRendererPlus</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:verticalAxisRenderers</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:horizontalAxis</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:CategoryAxis</span> categoryField=<span style="color: #ff0000;">&quot;Country&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:horizontalAxis</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:series</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColumnSeries</span> displayName=<span style="color: #ff0000;">&quot;Gold&quot;</span> yField=<span style="color: #ff0000;">&quot;Gold&quot;</span> verticalAxis=<span style="color: #ff0000;">&quot;{vAxis}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColumnSeries</span> displayName=<span style="color: #ff0000;">&quot;Silver&quot;</span> yField=<span style="color: #ff0000;">&quot;Silver&quot;</span> verticalAxis=<span style="color: #ff0000;">&quot;{vAxis}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColumnSeries</span> displayName=<span style="color: #ff0000;">&quot;Bronze&quot;</span> yField=<span style="color: #ff0000;">&quot;Bronze&quot;</span> verticalAxis=<span style="color: #ff0000;">&quot;{vAxis}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:series</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ColumnChart</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;千位符:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:CheckBox</span> id=<span style="color: #ff0000;">&quot;thousandsSeparator&quot;</span> selected=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;小数点位数:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:NumericStepper</span> id=<span style="color: #ff0000;">&quot;precision&quot;</span> minimum=<span style="color: #ff0000;">&quot;0&quot;</span> maximum=<span style="color: #ff0000;">&quot;2&quot;</span> stepSize=<span style="color: #ff0000;">&quot;1&quot;</span> value=<span style="color: #ff0000;">&quot;1&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;前缀:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextInput</span> id=<span style="color: #ff0000;">&quot;prefix&quot;</span> text=<span style="color: #ff0000;">&quot;$&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;后缀:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:TextInput</span> id=<span style="color: #ff0000;">&quot;suffix&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;单位:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ComboBox</span> id=<span style="color: #ff0000;">&quot;moneyUnits&quot;</span><span style="color: #7400FF;">&gt;</span></span>
					<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Array</span><span style="color: #7400FF;">&gt;</span></span>
						<span style="color: #000000;"><span style="color: #7400FF;">&lt;charts:MoneyUnits</span> label=<span style="color: #ff0000;">&quot;无&quot;</span> unit=<span style="color: #ff0000;">&quot;{MoneyUnits.NONE}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
						<span style="color: #000000;"><span style="color: #7400FF;">&lt;charts:MoneyUnits</span> label=<span style="color: #ff0000;">&quot;百&quot;</span> unit=<span style="color: #ff0000;">&quot;{MoneyUnits.HUNDRED}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
						<span style="color: #000000;"><span style="color: #7400FF;">&lt;charts:MoneyUnits</span> label=<span style="color: #ff0000;">&quot;千&quot;</span> unit=<span style="color: #ff0000;">&quot;{MoneyUnits.THOUSAND}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
						<span style="color: #000000;"><span style="color: #7400FF;">&lt;charts:MoneyUnits</span> label=<span style="color: #ff0000;">&quot;万&quot;</span> unit=<span style="color: #ff0000;">&quot;{MoneyUnits.TEN_THOUSAND}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
						<span style="color: #000000;"><span style="color: #7400FF;">&lt;charts:MoneyUnits</span> label=<span style="color: #ff0000;">&quot;十万&quot;</span> unit=<span style="color: #ff0000;">&quot;{MoneyUnits.LAKH}&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
					<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Array</span><span style="color: #7400FF;">&gt;</span></span>
				<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ComboBox</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:Form</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Panel</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

<p>Ps: 全部代码请查看: <a onclick="javascript:pageTracker._trackPageview('/outbound/article/code.google.com');" href="http://code.google.com/p/beasy-flex-library/">http://code.google.com/p/beasy-flex-library/</a> 这里包含了本博所有文章源码.<br />
SVN: <a onclick="javascript:pageTracker._trackPageview('/outbound/article/beasy-flex-library.googlecode.com');" href="http://beasy-flex-library.googlecode.com/svn/trunk/">http://beasy-flex-library.googlecode.com/svn/trunk/</a></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2010/01/custom-axis-label/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>StyleBindingUtils可以绑定样式的工具类</title>
		<link>http://www.beasy.org/2010/01/style-binding-utils/</link>
		<comments>http://www.beasy.org/2010/01/style-binding-utils/#comments</comments>
		<pubDate>Tue, 05 Jan 2010 13:28:05 +0000</pubDate>
		<dc:creator>marco</dc:creator>
				<category><![CDATA[原创文章]]></category>
		<category><![CDATA[binding]]></category>
		<category><![CDATA[flex]]></category>

		<guid isPermaLink="false">http://www.beasy.org/?p=92</guid>
		<description><![CDATA[Flex自带的有一个BindingUtils类，可以把两个类的属性绑定起来，但是不能绑定样式(Style)，样式是Flex中常用的特性，看其BindingUtils源码，绑定技术本身是依靠于ChangeWatcher，所以照着BindingUtils写一个可以绑定样式的方法。 StyleBindingUtils: package org.beasy.binding.utils &#123; import mx.binding.utils.ChangeWatcher; import mx.styles.IStyleClient; &#160; /** * Flex的绑定功能为我们的日常提供很多的方便 * 但是Flex只提供了属性的绑定类-&#62;BindingUtils; * 如果要实现绑定控件的Style还要自己用ChangeWatcher去侦听事件 * 有了StyleBindingUtils这一切将变的简单 * StyleBindingUtils封装了ChangeWatcher进行了Style的绑定实现, * 为您的开发提供了更多方便和快捷 * @author Marco */ public class StyleBindingUtils &#123; public function StyleBindingUtils&#40;&#41; &#123; &#125; &#160; public static function bindStyle&#40; site:IStyleClient, prop:String, host:Object, chain:Object, commitOnly:Boolean = false&#41;:ChangeWatcher &#123; var w:ChangeWatcher = ChangeWatcher.watch&#40;host, chain, null, [...]]]></description>
			<content:encoded><![CDATA[<p>Flex自带的有一个BindingUtils类，可以把两个类的属性绑定起来，但是不能绑定样式(Style)，样式是Flex中常用的特性，看其BindingUtils源码，绑定技术本身是依靠于ChangeWatcher，所以照着BindingUtils写一个可以绑定样式的方法。<br />
StyleBindingUtils:</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:monospace;"><span style="color: #9900cc; font-weight: bold;">package</span> org<span style="color: #000066; font-weight: bold;">.</span>beasy<span style="color: #000066; font-weight: bold;">.</span>binding<span style="color: #000066; font-weight: bold;">.</span>utils
<span style="color: #000000;">&#123;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>binding<span style="color: #000066; font-weight: bold;">.</span>utils<span style="color: #000066; font-weight: bold;">.</span>ChangeWatcher<span style="color: #000066; font-weight: bold;">;</span>
	<span style="color: #0033ff; font-weight: bold;">import</span> mx<span style="color: #000066; font-weight: bold;">.</span>styles<span style="color: #000066; font-weight: bold;">.</span>IStyleClient<span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
	<span style="color: #3f5fbf;">/**
	 * Flex的绑定功能为我们的日常提供很多的方便
	 * 但是Flex只提供了属性的绑定类-&gt;BindingUtils;
	 * 如果要实现绑定控件的Style还要自己用ChangeWatcher去侦听事件
	 * 有了StyleBindingUtils这一切将变的简单
	 * StyleBindingUtils封装了ChangeWatcher进行了Style的绑定实现,
	 * 为您的开发提供了更多方便和快捷
	 * @author Marco
	 */</span>
	<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> StyleBindingUtils
	<span style="color: #000000;">&#123;</span>
		<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> StyleBindingUtils<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>
		<span style="color: #000000;">&#123;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
		<span style="color: #0033ff; font-weight: bold;">public</span> static <span style="color: #339966; font-weight: bold;">function</span> bindStyle<span style="color: #000000;">&#40;</span>
			site<span style="color: #000066; font-weight: bold;">:</span>IStyleClient<span style="color: #000066; font-weight: bold;">,</span> prop<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">String</span><span style="color: #000066; font-weight: bold;">,</span>
			host<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000066; font-weight: bold;">,</span> chain<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Object</span><span style="color: #000066; font-weight: bold;">,</span>
			commitOnly<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span>ChangeWatcher
		<span style="color: #000000;">&#123;</span>
			<span style="color: #6699cc; font-weight: bold;">var</span> w<span style="color: #000066; font-weight: bold;">:</span>ChangeWatcher =
				ChangeWatcher<span style="color: #000066; font-weight: bold;">.</span>watch<span style="color: #000000;">&#40;</span>host<span style="color: #000066; font-weight: bold;">,</span> chain<span style="color: #000066; font-weight: bold;">,</span> <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000066; font-weight: bold;">,</span> commitOnly<span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>w <span style="color: #000066; font-weight: bold;">!</span>= <span style="color: #0033ff; font-weight: bold;">null</span> <span style="color: #000000;">&#41;</span>
			<span style="color: #000000;">&#123;</span>
				<span style="color: #6699cc; font-weight: bold;">var</span> assign<span style="color: #000066; font-weight: bold;">:</span><span style="color: #004993;">Function</span> = <span style="color: #339966; font-weight: bold;">function</span><span style="color: #000000;">&#40;</span>event<span style="color: #000066; font-weight: bold;">:*</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span>
				<span style="color: #000000;">&#123;</span>
					site<span style="color: #000066; font-weight: bold;">.</span><span style="color: #004993;">setStyle</span><span style="color: #000000;">&#40;</span>prop<span style="color: #000066; font-weight: bold;">,</span> w<span style="color: #000066; font-weight: bold;">.</span>getValue<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				<span style="color: #000000;">&#125;</span>
				w<span style="color: #000066; font-weight: bold;">.</span>setHandler<span style="color: #000000;">&#40;</span> assign <span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
				assign<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span><span style="color: #000066; font-weight: bold;">;</span>
			<span style="color: #000000;">&#125;</span>
&nbsp;
			<span style="color: #0033ff; font-weight: bold;">return</span> w<span style="color: #000066; font-weight: bold;">;</span>
		<span style="color: #000000;">&#125;</span>
&nbsp;
	<span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p><span id="more-92"></span><br />
测试页面：</p>

<div class="wp_syntax"><div class="code"><pre class="mxml" style="font-family:monospace;"><span style="color: #000000;">&lt;?xml version=<span style="color: #ff0000;">&quot;1.0&quot;</span> encoding=<span style="color: #ff0000;">&quot;utf-8&quot;</span>?<span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;s:Application</span> xmlns:fx=<span style="color: #ff0000;">&quot;http://ns.adobe.com/mxml/2009&quot;</span> </span>
<span style="color: #000000;">			   xmlns:s=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/spark&quot;</span> </span>
<span style="color: #000000;">			   xmlns:charts=<span style="color: #ff0000;">&quot;org.beasy.charts.*&quot;</span></span>
<span style="color: #000000;">			   xmlns:mx=<span style="color: #ff0000;">&quot;library://ns.adobe.com/flex/halo&quot;</span> minWidth=<span style="color: #ff0000;">&quot;1024&quot;</span> minHeight=<span style="color: #ff0000;">&quot;768&quot;</span> fontSize=<span style="color: #ff0000;">&quot;12&quot;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;">&lt;!<span style="color: #66cc66;">&#91;</span>CDATA<span style="color: #66cc66;">&#91;</span></span>
<span style="color: #000000;">			import mx.graphics.SolidColorStroke;</span>
&nbsp;
<span style="color: #000000;">			import org.beasy.binding.utils.StyleBindingUtils;</span>
&nbsp;
<span style="color: #000000;">			/**</span>
<span style="color: #000000;">			 * 定义一个Stroke, 默认颜色为0x333333</span>
<span style="color: #000000;">			 */</span>
<span style="color: #000000;">			private var background:SolidColorStroke = new SolidColorStroke<span style="color: #66cc66;">&#40;</span>0x333333, <span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;</span>
&nbsp;
<span style="color: #000000;">			private function init<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				/**</span>
<span style="color: #000000;">				 * 进行绑定:把container的borderColor样式属性绑定到borderStroke的color属性上</span>
<span style="color: #000000;">				 */</span>
<span style="color: #000000;">				StyleBindingUtils.bindStyle<span style="color: #66cc66;">&#40;</span>container, <span style="color: #ff0000;">&quot;backgroundColor&quot;</span>, background, <span style="color: #ff0000;">&quot;color&quot;</span><span style="color: #66cc66;">&#41;</span>;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
&nbsp;
<span style="color: #000000;">			private function changeHandler<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>:void</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#123;</span></span>
<span style="color: #000000;">				/**</span>
<span style="color: #000000;">				 * 设置borderStroke的color属性</span>
<span style="color: #000000;">				 * 被绑定对象会联运变化</span>
<span style="color: #000000;">				 */</span>
<span style="color: #000000;">				background.color = backgroundColor.selectedColor;</span>
<span style="color: #000000;">			<span style="color: #66cc66;">&#125;</span></span>
<span style="color: #000000;">		<span style="color: #66cc66;">&#93;</span><span style="color: #66cc66;">&#93;</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/fx:Script</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:Canvas</span> width=<span style="color: #ff0000;">&quot;200&quot;</span> height=<span style="color: #ff0000;">&quot;200&quot;</span> id=<span style="color: #ff0000;">&quot;container&quot;</span> borderThickness=<span style="color: #ff0000;">&quot;2&quot;</span> borderStyle=<span style="color: #ff0000;">&quot;solid&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ControlBar</span> width=<span style="color: #ff0000;">&quot;100%&quot;</span><span style="color: #7400FF;">&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:FormItem</span> label=<span style="color: #ff0000;">&quot;背景色:&quot;</span><span style="color: #7400FF;">&gt;</span></span>
			<span style="color: #000000;"><span style="color: #7400FF;">&lt;mx:ColorPicker</span> id=<span style="color: #ff0000;">&quot;backgroundColor&quot;</span> change=<span style="color: #ff0000;">&quot;changeHandler()&quot;</span><span style="color: #7400FF;">/&gt;</span></span>
		<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:FormItem</span><span style="color: #7400FF;">&gt;</span></span>
	<span style="color: #000000;"><span style="color: #7400FF;">&lt;/mx:ControlBar</span><span style="color: #7400FF;">&gt;</span></span>
<span style="color: #000000;"><span style="color: #7400FF;">&lt;/s:Application</span><span style="color: #7400FF;">&gt;</span></span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.beasy.org/2010/01/style-binding-utils/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

