<?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>数据可视化</title>
	<atom:link href="http://www.datavisualization.cn/index.php/feed" rel="self" type="application/rss+xml" />
	<link>http://www.datavisualization.cn</link>
	<description>一图抵千言</description>
	<lastBuildDate>Sat, 30 Jan 2010 13:54:51 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>日记</title>
		<link>http://www.datavisualization.cn/index.php/dirly.html</link>
		<comments>http://www.datavisualization.cn/index.php/dirly.html#comments</comments>
		<pubDate>Sat, 30 Jan 2010 13:53:32 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[dropbox]]></category>

		<guid isPermaLink="false">http://www.datavisualization.cn/index.php/%e6%97%a5%e8%ae%b0.html</guid>
		<description><![CDATA[<p>这是日记，看不到</p<br/>... ]]></description>
			<content:encoded><![CDATA[<p>这是日记，看不到</p>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/dirly.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Test from android</title>
		<link>http://www.datavisualization.cn/index.php/test-from-android.html</link>
		<comments>http://www.datavisualization.cn/index.php/test-from-android.html#comments</comments>
		<pubDate>Thu, 14 Jan 2010 09:40:49 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[status]]></category>
		<category><![CDATA[android]]></category>

		<guid isPermaLink="false">http://www.datavisualization.cn/index.php/test-from-android.html</guid>
		<description><![CDATA[<p>Test from android</p<br/>... ]]></description>
			<content:encoded><![CDATA[<p>Test from android</p>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/test-from-android.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>test via mobile</title>
		<link>http://www.datavisualization.cn/index.php/test-via-mobile.html</link>
		<comments>http://www.datavisualization.cn/index.php/test-via-mobile.html#comments</comments>
		<pubDate>Wed, 13 Jan 2010 08:46:18 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[status]]></category>

		<guid isPermaLink="false">http://www.datavisualization.cn/index.php/test-via-mobile.html</guid>
		<description><![CDATA[<p>test via mobile</p<br/>... ]]></description>
			<content:encoded><![CDATA[<p>test via mobile</p>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/test-via-mobile.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The State of Information Visualization</title>
		<link>http://www.datavisualization.cn/index.php/the-state-of-information-visualization.html</link>
		<comments>http://www.datavisualization.cn/index.php/the-state-of-information-visualization.html#comments</comments>
		<pubDate>Tue, 12 Jan 2010 09:16:49 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[data visualization]]></category>

		<guid isPermaLink="false">http://www.datavisualization.cn/?p=325</guid>
		<description><![CDATA[转载：<a href="http://eagereyes.org/blog/2010/state-of-infovis-2010" target="_blank">http://eagereyes.org/blog/2010/state-of-infovis-2010</a>
<a href="http://eagereyes.org/blog/2010/state-of-infovis-2010"><img src="http://eagereyes.org/media/2010/minard.jpg" border="0" alt="Minard's &#34;Napoleon's March to Moscow&#34;, Protovis demo" width="560" height="173" /></a>
Information Visualization (<br/>... ]]></description>
			<content:encoded><![CDATA[<p>转载：<a href="http://eagereyes.org/blog/2010/state-of-infovis-2010" target="_blank">http://eagereyes.org/blog/2010/state-of-infovis-2010</a></p>
<p><a href="http://eagereyes.org/blog/2010/state-of-infovis-2010"><img src="http://eagereyes.org/media/2010/minard.jpg" border="0" alt="Minard's &quot;Napoleon's March to Moscow&quot;, Protovis demo" width="560" height="173" /></a></p>
<p>Information Visualization (InfoVis) is an exciting field to watch grow and expand into ever new areas. Last year brought some interesting developments that point towards changes in how we do and see visualization. What does 2010 hold in store? Here is a look back and some ideas where we&#8217;re heading.</p>
<h2>2009: What Was</h2>
<blockquote><p>2009年可视化领域最重要的事是数据获取</p></blockquote>
<p>Until May 2009, the biggest issue in visualization was <span style="color: #ff0000;"><strong>access to good data</strong></span>. There were a few standard data sets, and when working with companies we would sometimes get some of their data (which we were not able to share, of course); but comparing visualizations without interesting test data was difficult. <a href="http://data.gov/" target="_blank"><strong><span style="color: #ff0000;">Data.gov</span></strong></a>(and similar websites in other countries) changed all of that. Suddenly, there is more data than we really know what to do with, and more is coming. There are some issues with inflated numbers of data sets (e.g., toxic release data has separate data sets for each state and year), but it&#8217;s still a fantastic service and points into the right direction. The recent release of <a href="http://www.metoffice.gov.uk/climatechange/science/monitoring/subsets.html" target="_blank">climate data</a> (even if for the wrong reasons) also provided us with some interesting material to dig into. In my opinion, the availability of large amounts of new data was the biggest thing to happen for InfoVis in 2009.</p>
<p>With great data comes great responsibility. We need to figure out ways to do what <em>InfoVis for the Masses</em> has promised for a few years now: easy access to all the relevant data for everybody. Now that we finally have the data, we need to build more and better visualizations. A key event in that direction was the release of <a href="http://protovis.org/" target="_blank">Protovis</a>. It is billed as an easy way to build visualizations, and it is very powerful; but the key is that it runs directly in the browser, without the need for plugins. The only issue at the moment is that Internet Explorer does not support the canvas element that Protovis needs, but there are libraries that emulate that using the equivalent IE mechanism. Once this is solved, Protovis will be the way to go for web-based visualization of open data.</p>
<p>What makes Protovis (and also Tableau Public, see below) more interesting than<a href="http://many-eyes.com/" target="_blank">Many Eyes</a> and other visualization-as-a-service websites so far is the fact that you can create new visualizations for your data, and that you can combine and link several views. The up-front effort to build a visualization is certainly higher, but it also provides a lot more possibilities.</p>
<p>Protovis was presented at InfoVis/VisWeek 2009, and there were also two other papers that will prove to have a lasting effect: Tamara Munzner&#8217;s <em><a href="http://www.cs.ubc.ca/labs/imager/tr/2009/NestedModel/" target="_blank">A Nested Model for Visualization Design and Validation</a></em> and Chris Weaver&#8217;s <em><a href="http://www.cs.ou.edu/~weaver/academic/publications/weaver-2009b.pdf" target="_blank">Conjunctive Visual Forms </a><a href="http://www.cs.ou.edu/~weaver/academic/publications/weaver-2009b.pdf" target="_blank">(PDF)</a></em>. While very different, the two papers were similar in one respect: they were theory papers. There haven&#8217;t been any theoretical papers in InfoVis recently, and I hope that this is a sign that this type of paper is becoming more acceptable again. The field certainly needs more of the digestion and deep thinking these two examples showed.</p>
<p>An event that involved yours truly was the release of the <a href="http://eagereyes.org/parallel-sets" target="_blank">Parallel Sets</a> program in early June. The tool is finding quite a few users, and we were able to submit an entry to the <a href="http://www.discoveryexhibition.org/" target="_blank">Discovery Exhibition</a> (and win a prize there). While progress with updates hasn&#8217;t been quite as fast as hoped, we have a lot more features planned and hope to release an updated version soon. What is more, we hope to inspire more InfoVis researchers to release their programs to get more tools into people&#8217;s hands.</p>
<h2>2010: What Will Be</h2>
<p>Looking forward, what can we expect from the new year? One product that will have a big impact is <a href="http://public.tableausoftware.com/" target="_blank">Tableau Public</a>. Currently in beta, it will be released in early 2010. It&#8217;s a fully functioning version of Tableau Desktop, but it can only save its data to Tableau&#8217;s public server (and there are limits on dataset size and data sources). Unlike Protovis, Tableau Public is server-based, with an embedding mechanism that only requires JavaScript. Like Protovis, Tableau offers the possibility to combine different visualizations into a view, with linking between them. The setup is much easier though, and requires no programming.</p>
<p>I will be writing more about JavaScript-based in-browser visualization soon, because I believe that this is the way to go for anything that is meant to be presented to the general public. JavaScript works everywhere, it&#8217;s fast and flexible. There are already a number of visualization frameworks with varying levels of sophistication out there, though Protovis and Tableau Public are by far the most interesting. Together with the availability of lots of data, they will enable InfoVis for the Masses to make a big leap forward in 2010, and finally really reach the masses.</p>
<p>Data.gov et al. are a great start, but a lot more is needed. A lot of the data on data.gov is not of much interest to end users right now, and there hasn&#8217;t been a lot of new material in a while. That will change this year. Obama&#8217;s <a href="http://www.whitehouse.gov/open/documents/open-government-directive" target="_blank">Open Government Directive</a> has the potential of opening the floodgates on tons of data that is currently only kept secret because nobody is bothering to publish it. The promise of open data has also been so clear and so loud that a lot more action has to follow for people to really believe it. I am convinced that we will finally see the hundreds of thousands of data sets on data.gov that were rumored, and that many of those data sets will be of much greater interest than what we have seen so far.</p>
<p>In addition to the practical visualization uses, 2010 might be the year of visualization theory. While our field is certainly an applied one, we still need a much deeper understanding of how it works and how to build better tools. There is some existing work, but much of that is old (Bertin&#8217;s work was published in the 1960s, Mackinlay&#8217;s almost 25 years ago, Shneiderman&#8217;s 13 years ago, Chi&#8217;s taxonomy almost ten years ago). The field is progressing and we are developing new tools that do not always fit the old molds. We are also gaining a better understanding of how things work, and we are seeing interesting new concepts from other fields. So an update of our theoretical foundations is really overdue now, and this year will hopefully be when it happens.</p>
<p>Another trend that seems to be obvious is a continued interest in visualizing data from bioinformatics. There were seven papers at InfoVis and VAST last year (including the InfoVis Best Paper and an Honorable Mention), but there are still a lot of open problems and terribly unusable tools in bioinformatics. We can have a big impact there, and maybe influence the thinking there to become a lot more visual.</p>
<h2>Beyond 2010: What Is to Come</h2>
<p>In the longer term, the key will be to engage people&#8217;s visual thinking skills. As long as visualization is mostly representation, it adds too little to what people can already do. Once we are able to not just show them the data, but stimulate them to think about (and with) it, they will realize the value of visualization. This is true for general audiences as well as very specialized uses: we need to move from visualization to visual analysis, and from representation to problem-solving.</p>
<p>Engaging people does not require interaction, but it will play a bigger role in the future. Interaction in visualization has been stagnant for a while, but I predict that a new class of interactions will be developed before too long. There are some obvious things (like touch interaction), but there has to be more than pointing at objects on the screen. How can we better support efficient visual work with complex data? How can we select in many dimensions at once? How can we specify complex filters and criteria without lots of tedious steps?</p>
<p>Bioinformatics will keep us busy for some time. There is a lot of data there, and more is generated all the time. There&#8217;s almost any type of data you want to work with: unstructured, graphs, trees, temporal, etc. And there are lots of issues with uncertainty, data quality, data size, etc. that require new ideas and solutions. While I doubt that it will happen, we could do a lot worse than become a part of bioinformatics. The funding opportunities alone are mind-blowing.</p>
<p>Another very promising area is journalism. As it is increasingly based on data, InfoVis will play a bigger role in the analysis that leads to a story, as well as its presentation. At the moment, charts are only done to support a story and to give people something to play with. But why not make the visualization the central element, and only provide textual explanations as needed? To make that feasible, much better tools for creating visualizations will be needed that do not require programming but still enable the user to create new types of highly specific visualizations.</p>
<p>It&#8217;s safe to say that we will not run out of interesting work anytime soon. We will need to break out of the ivory tower more if we want to stay relevant, though. Given the visual nature of our field, that should not be too difficult, though.</p>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/the-state-of-information-visualization.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>sparkline 介绍</title>
		<link>http://www.datavisualization.cn/index.php/sparkline-intro.html</link>
		<comments>http://www.datavisualization.cn/index.php/sparkline-intro.html#comments</comments>
		<pubDate>Mon, 04 Jan 2010 02:08:49 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[data visualization]]></category>

		<guid isPermaLink="false">http://www.datavisualization.cn/?p=289</guid>
		<description><![CDATA[<a href="http://en.wikipedia.org/wiki/Sparkline" target="_blank">Sparkline</a>是<a href="http://www.edwardtufte.com/tufte/" target="_blank">Edward Tufte</a>(爱德华•塔夫特)起的名字，指的是“密集的，简单的，文字大小的图形。”它们要在没有展开的情况下，传达上下文的数据&#8221;。
最常见的数据展示方式是一个名词,后面跟一个数字<br/>... ]]></description>
			<content:encoded><![CDATA[<p><a href="http://en.wikipedia.org/wiki/Sparkline" target="_blank">Sparkline</a>是<a href="http://www.edwardtufte.com/tufte/" target="_blank">Edward Tufte</a>(爱德华•塔夫特)起的名字，指的是“密集的，简单的，文字大小的图形。”它们要在没有展开的情况下，传达上下文的数据&#8221;。</p>
<p>最常见的数据展示方式是一个名词,后面跟一个数字,比如显示病人的血糖含量:</p>
<blockquote><p>血糖:128</p></blockquote>
<p>像上面把一个数字放在恰当的地方,这个数字就有个额外的含义.但现代的医学在测量病人的血糖是通常要和之前的测量记录进行比较.下面用一条线表示最近80次的测量结果:</p>
<blockquote><p><img class="alignnone" title="glucose1" src="http://img.skitch.com/20100104-tqk68hd3yr88fife9dii3aqpes.jpg" alt="" />血糖:128</p></blockquote>
<p>在没有放大的情况下,我们无法精确得知每一点的数据,但我们至少可以知道个大概,我们还可以用颜色把数据点和数值&#8221;绑定&#8221;起来</p>
<blockquote><p><img title="glucose1" src="http://img.skitch.com/20100104-ex5pskx5rk998nccknf4cw4djc.jpg" alt="" />血糖:<span style="color: #ff0000;">128</span></p></blockquote>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/sparkline-intro.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3数据结构(介绍)</title>
		<link>http://www.datavisualization.cn/index.php/as3-data-structure-introduce.html</link>
		<comments>http://www.datavisualization.cn/index.php/as3-data-structure-introduce.html#comments</comments>
		<pubDate>Wed, 20 May 2009 16:04:42 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[data structure]]></category>

		<guid isPermaLink="false">http://www.mojojo.org/index.php/as3%e6%95%b0%e6%8d%ae%e7%bb%93%e6%9e%84%e4%bb%8b%e7%bb%8d.html</guid>
		<description><![CDATA[<strong>as3ds is no longer supported</strong>
The next version of as3ds is being <a href="http://code.google.com/p/polygonal/">developed</a> using the HaXe language and is simply called <strong>ds</strong>. ActionScript 3.0 will be st[......]<p class='read-more'><a href='http://www.datavisualization.cn/index.php/as3-data-structure-introduce.html'>继续阅读</a></p<br/>... ]]></description>
			<content:encoded><![CDATA[<blockquote><p><strong><span style="color: #f0149a;">as3ds is no longer supported</span></strong><br />
The next version of as3ds is being <a href="http://code.google.com/p/polygonal/">developed</a> using the HaXe language and is simply called <strong>ds</strong>. ActionScript 3.0 will be still supported through an SWC library.<img style="display: inline; margin-left: 0px; margin-right: 0px;" src="http://lab.polygonal.de/wp-content/uploads/ds_logo.gif" alt="ds_logo.gif" align="right" /></p></blockquote>
<ul>
<li>当前版本: 1.04, <a href="http://code.google.com/p/as3ds/wiki/Changelog">Changelog</a></li>
<li>下载源码: <a href="http://as3ds.googlecode.com/files/as3ds_1.04.zip">as3ds_1.04.zip</a>, 版权证书<a href="http://www.opensource.org/licenses/mit-license.php">MIT</a></li>
<li>项目首页: <a href="http://as3ds.googlecode.com">http://as3ds.googlecode.com</a></li>
<li>如果将此项目用于商业途径,请捐点银子 :)</li>
<li>作者主页:<a title="http://lab.polygonal.de/ds/" href="http://lab.polygonal.de/ds/">http://lab.polygonal.de/ds/</a></li>
</ul>
<h2>简介</h2>
<p>AS3数据结构(游戏开发版)是一个包含用于flash游戏和应用程序开发的的数据结构包.做这个项目的初衷是我想把我在游戏开发中使用的类库集合到一起.</p>
<h2>设计决策</h2>
<p>我一直努力地提供最基本的算法，加上少量我认为是最有用的方法。因此,简单性和高性能是这个项目的主要特点和指导方针。</p>
<p>-所有的结构都没有指定类型.这样用起来会更加流畅和简单,因为不必通过继承或者实现接口来新建一个特殊的容器.</p>
<p>-我常常不严格遵守设计模式和面向对象的规则.比如说,如果我想访问一个类的属性,我会直接把这个属性设置为public,而不是用getter/setter方法.</p>
<p>-所有的结构都放在同一个包里,原因很简单,因为不好分呗.比如:链表可以看做是一个树,而树从某个角度来说是一个不是很严格的链表.</p>
<p>-很多结构都是使用自己的代码实现而不是通过使用其他已有的结构.比如说图表结构,本来应该是在链表和队列的基础上实现的,但是实际上还是用普通的数组实现,应为这样更快.</p>
<h2>集合(Collection)</h2>
<p>几乎所有的类都实现&#8221;集合(Collection)&#8221;这个接口,该接口定义了一下几个方法:</p>
<p>contains(obj:*),用于检查一个项是否存在于该结构中</p>
<p>clear(),用于清除所有项</p>
<p>getIterator(),获得一个迭代对象,用于遍历该结构</p>
<p>toArray(),把该结构转换为数组</p>
<h2>使用迭代器</h2>
<p>所有实现了Collection接口的类都可以通过getItertor()这个方法来创建一个迭代对象.一旦你拥有该对象,你就可以自由访问该结构:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00"></span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p212code2'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p2122"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p212code2"><pre class="actionscript" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">var</span> myItr:Iterator = getIterator<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> value:<span style="color: #66cc66;">*</span>;
&nbsp;
<span style="color: #808080; font-style: italic;">//read all values</span>
<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>myItr.<span style="color: #006600;">hasNext</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    value = myItr.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//write new value</span>
myItr.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #b1b100;">while</span> <span style="color: #66cc66;">&#40;</span>myItr.<span style="color: #006600;">hasNext</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    myItr.<span style="color: #0066CC;">data</span> = <span style="color: #ff0000;">&quot;newValue&quot;</span>;
    next<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #808080; font-style: italic;">//the same with a for loop</span>
<span style="color: #b1b100;">for</span> <span style="color: #66cc66;">&#40;</span>myItr.<span style="color: #0066CC;">start</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; myItr.<span style="color: #006600;">hasNext</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>; myItr.<span style="color: #006600;">next</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>
<span style="color: #66cc66;">&#123;</span>
    value = myItr.<span style="color: #0066CC;">data</span>;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

<h2>数据结构</h2>
<h3>多维数组</h3>
<p>该类库中包含二维数组和三维数组,他们都是用简单的线性数组实现的,而不是用网状的数组.这是flash里面模拟多维数组最好的方法,这比使用嵌套数组更快.因为在flash中,查找多个数组没有查找通过简单算法结合起来的单个数组快.这在二维地图或分层的三维地图这样的应用中最为明显.</p>
<h3>队列(Queue)</h3>
<p>又叫FIFO(先进先出)结构,队列有两种方法,具体实现时不一样.一种是基于链表,另一种基于数组,他们的不同之处是基于数组的长度固定而且更快.</p>
<h3>栈(Stack)</h3>
<p>通常叫他FILO(先进后出)结构.和队列一样,有两种实现方法:链表和数组.栈通常不会直接使用,但却是编程中的一个重要概念.请注意,队列和栈不是真正意义上的数据结构,因为他们只定义了数据如何存取而非存储.</p>
<h3>树(Tree)</h3>
<p>基于节点(node)的一种数据结构,所有的树都从一个节点开始,这个节点就叫做根节点(root node),根节点可以包含多个子节点,而子节点又可以包含多个子节点.树中不包含子节点的节点叫做页节点(leaf node).实际上如果把一个包含子节点的树结构画出来,真的像一棵有树枝的树.AS3的现实结构也是一个树结构.</p>
<h3>二叉树(Binary Tree)</h3>
<p>二叉树是树的一种特殊形式,每个节点最多只能有两个子节点,叫做左节点和右节点.二叉树经常被用作数据解析,算数表达式和脚本系统(看不懂).</p>
<h3>二叉查找树(Binary Search Tree, BST)和哈希表(Hash Table)</h3>
<p>这两种结果都可以通过关键字来迅速进行查找,但方法却有很大不同,BST的方法是通过递归逐步接近,哈希表专门用一部分空间来存储少量有关键字的索引数据.</p>
<h3>链表(Linked Lists)</h3>
<p>链表和数组很像.主要的区别在于,数组中的每个元素只包含数据,并可以通过索引来访问.链表不仅包含数据,还包含数据的前后数据的信息,就好象这些数据也是按顺序链接起来的.另外一个好处是:在要插入或删除一个节点时,只需要调用一个节点的相关方法.不需要去管理索引.在AS3中,操作对象比操作数组要快.</p>
<h3>堆和优先级队列(Heap and Priority Queue)</h3>
<p>堆是一种特殊的二叉树,他的节点要比子节点大.不管你扔什么数值进去,他都会自动排序(基于比较方法),优先级队列基于堆.可以区分数据的优先级次序.</p>
<h3>图表(Graph)</h3>
<p>图表是一种宽松的基于节点的结构,任意两个节点之间可以直接连接(单向或双向),这种结构是寻路算法,人工智能和动态软体等大型系统中必不可少的.</p>
<h3>位向量(Bit Vector)</h3>
<p>位向量可以用很少的内存来存储Boolean变量.目前还找不到合适的应用(因为通常内存都是够用的),但他还是有意义的,因为其体现了基本的遮罩操作(masking operations,没看懂).</p>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/as3-data-structure-introduce.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>open flash chart 教程翻译（3）&#8212;&#8212;生成数据文件(PHP篇)</title>
		<link>http://www.datavisualization.cn/index.php/ofc-tutorial-write-json-php.html</link>
		<comments>http://www.datavisualization.cn/index.php/ofc-tutorial-write-json-php.html#comments</comments>
		<pubDate>Tue, 10 Mar 2009 07:59:16 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[openflashchart]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.mojojo.org/index.php/ofc-tutorial-write-json-php.html</guid>
		<description><![CDATA[继续上一篇：<a href="http://www.mojojo.org/index.php/ofc-tutorial-data-files.html">open flash chart 教程翻译（2）——数据文件</a>
1 生成JSON文件
如何使用PHP库生成JSON文件:

<a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"></a><a href="javascript:;" onclick="javascript:showCodeTxt('p189code3'); retur<br/>... ]]></description>
			<content:encoded><![CDATA[<p>继续上一篇：<a href="http://www.mojojo.org/index.php/ofc-tutorial-data-files.html">open flash chart 教程翻译（2）——数据文件</a></p>
<h3>1 生成JSON文件</h3>
<p>如何使用PHP库生成JSON文件:</p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00"></span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p189code4'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1894"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
</pre></td><td class="code" id="p189code4"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #b1b100;">include</span> <span style="color: #0000ff;">'../php-ofc-library/open-flash-chart.php'</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// generate some random data</span>
<a href="http://www.php.net/srand"><span style="color: #990000;">srand</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#40;</span>double<span style="color: #009900;">&#41;</span><a href="http://www.php.net/microtime"><span style="color: #990000;">microtime</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">1000000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$max</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">20</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$tmp</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">for</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">&lt;</span><span style="color: #cc66cc;">9</span><span style="color: #339933;">;</span> <span style="color: #000088;">$i</span><span style="color: #339933;">++</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #000088;">$tmp</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <a href="http://www.php.net/rand"><span style="color: #990000;">rand</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span><span style="color: #000088;">$max</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$title</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> title<span style="color: #009900;">&#40;</span> <a href="http://www.php.net/date"><span style="color: #990000;">date</span></a><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;D M d Y&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$bar</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> bar<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$bar</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_values</span><span style="color: #009900;">&#40;</span> <a href="http://www.php.net/array"><span style="color: #990000;">array</span></a><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">3</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">4</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">5</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">6</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">7</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">8</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">9</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$chart</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> open_flash_chart<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$chart</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">set_title</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$title</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$chart</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add_element</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$bar</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$chart</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/ofc-tutorial-write-json-php.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>open flash chart 教程翻译（2）&#8212;&#8212;数据文件</title>
		<link>http://www.datavisualization.cn/index.php/ofc-tutorial-data-files.html</link>
		<comments>http://www.datavisualization.cn/index.php/ofc-tutorial-data-files.html#comments</comments>
		<pubDate>Tue, 17 Feb 2009 01:19:50 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[openflashchart]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.mojojo.org/index.php/ofc-tutorial-data-files.html</guid>
		<description><![CDATA[继续上一篇：<a href="http://www.mojojo.org/index.php/ofc-tutorial-how-it-works.html">open flash chart 教程翻译（1）</a>
1 数据文件放在哪
除了在URL里添加数据的地址,ofc也有一个名为&#34;data-file&#34;的变量,可以在HTML里的JavaScript里设置:

<a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?<br/>... ]]></description>
			<content:encoded><![CDATA[<p>继续上一篇：<a href="http://www.mojojo.org/index.php/ofc-tutorial-how-it-works.html">open flash chart 教程翻译（1）</a></p>
<h3>1 数据文件放在哪</h3>
<p>除了在URL里添加数据的地址,ofc也有一个名为&quot;data-file&quot;的变量,可以在HTML里的JavaScript里设置:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00"></span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p124code6'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1246"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
</pre></td><td class="code" id="p124code6"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;js/swfobject.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
swfobject.embedSWF(
  &quot;open-flash-chart.swf&quot;, &quot;my_chart&quot;, &quot;550&quot;, &quot;200&quot;,
  &quot;9.0.0&quot;, &quot;expressInstall.swf&quot;,
  {&quot;data-file&quot;:&quot;chart-3.php&quot;}
  );
&lt;/script&gt;
&nbsp;
&nbsp;
&nbsp;
&lt;p&gt;Hello World&lt;/p&gt;
&lt;div id=&quot;my_chart&quot;&gt;&lt;/div&gt;</pre></td></tr></table></div>

<p>要实现上例的效果,必须要有swfobject,获取更多关于swfobject的信息,请参考<a href="http://code.google.com/p/swfobject/wiki/documentation">swfobject documentation</a>. </p>
<p>注意</p>
<ul>
<li>URL里面不需要再写&quot;ofc=&quot;. </li>
<li>当你要在一个页面里显示多个chart时,这种方法尤为有用. </li>
</ul>
<p>这一篇就这么多,下一篇讲如何利用现有的库生成所需的数据文件.</p>
<p>原文地址:<a title="http://teethgrinder.co.uk/open-flash-chart-2/tutorial-3.php" href="http://teethgrinder.co.uk/open-flash-chart-2/tutorial-3.php">http://teethgrinder.co.uk/open-flash-chart-2/tutorial-3.php</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/ofc-tutorial-data-files.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>open flash chart 教程翻译（1）——入门实例</title>
		<link>http://www.datavisualization.cn/index.php/ofc-tutorial-how-it-works.html</link>
		<comments>http://www.datavisualization.cn/index.php/ofc-tutorial-how-it-works.html#comments</comments>
		<pubDate>Mon, 16 Feb 2009 04:32:53 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[openflashchart]]></category>
		<category><![CDATA[open flash chart]]></category>
		<category><![CDATA[translate]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://www.mojojo.org/index.php/ofc-tutorial-how-it-works.html</guid>
		<description><![CDATA[本教程演示如何在网页中加入一个简单的<a href="http://teethgrinder.co.uk/open-flash-chart-2" target="_blank">open-flash-chart</a>图表。
1.安装
首先要<a href="http://teethgrinder.co.uk/open-flash-chart-2/downloads.php" target="_blank">下载</a>一个名为Open Flash Chart .zip 的文件。
解压zip文件，里面有一个version-2文件夹，里面有很多东西，不过<br/>... ]]></description>
			<content:encoded><![CDATA[<p>本教程演示如何在网页中加入一个简单的<a href="http://teethgrinder.co.uk/open-flash-chart-2" target="_blank">open-flash-chart</a>图表。</p>
<h3>1.安装</h3>
<p>首先要<a href="http://teethgrinder.co.uk/open-flash-chart-2/downloads.php" target="_blank">下载</a>一个名为Open Flash Chart .zip 的文件。</p>
<p>解压zip文件，里面有一个version-2文件夹，里面有很多东西，不过只有一个swf文件是必要的，复制这个文件夹里的<b>open-flash-chart.swf</b> 文件到你的网站目录下（其实任意地方都可以啦）。</p>
<h3>2. 编辑HTML文件</h3>
<p>First create a new HTML file that will show a simple &#8216;hello world!&#8217; page. Copy the following into a new file, save it as &#8216;<b>chart.html</b>&#8216; in the root of your website. </p>
<p>先新建一个html文件，比如叫“chart.html”,把下面的代码复制进去：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00"></span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p119code9'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1199"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
</pre></td><td class="code" id="p119code9"><pre class="html" style="font-family:monospace;">&lt;html&gt;
&lt;head&gt;
&nbsp;
&nbsp;
&nbsp;
&lt;p&gt;Hello World&lt;/p&gt;
&nbsp;
&nbsp;
&lt;object classid=&quot;clsid:d27cdb6e-ae6d-11cf-96b8-444553540000&quot;
        codebase=&quot;http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0&quot;
        width=&quot;500&quot;
		height=&quot;250&quot; id=&quot;graph-2&quot; align=&quot;middle&quot;&gt;
&nbsp;
	&lt;param name=&quot;allowScriptAccess&quot; value=&quot;sameDomain&quot; /&gt;
	&lt;param name=&quot;movie&quot; value=&quot;open-flash-chart.swf&quot; /&gt;
	&lt;param name=&quot;quality&quot; value=&quot;high&quot; /&gt;
	&lt;embed src=&quot;open-flash-chart.swf&quot; quality=&quot;high&quot; bgcolor=&quot;#FFFFFF&quot; width=&quot;500&quot; height=&quot;250&quot; name=&quot;open-flash-chart&quot; align=&quot;middle&quot; allowScriptAccess=&quot;sameDomain&quot; type=&quot;application/x-shockwave-flash&quot; pluginspage=&quot;http://www.macromedia.com/go/getflashplayer&quot; /&gt;
&lt;/object&gt;</pre></td></tr></table></div>

<p>这个html的作用就是把swf嵌入到网页里。</p>
<p>现在用浏览器打开这个html文件，你可以看到一个hello world的页面，不过没有图表，为啥？因为还没加数据呗^_^</p>
<h3>3添加数据</h3>
<p>大家都知道，图表的显示是基于数据的，ofc当然也需要数据，ofc使用的是一种叫做JSON的数据格式（读音像节丧），这种格式类似AS里的object，就是key：value这种，下面是一个JSON数据的示例：</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00"></span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p119code10'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p11910"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
</pre></td><td class="code" id="p119code10"><pre class="html" style="font-family:monospace;">{
  &quot;title&quot;:{
    &quot;text&quot;:  &quot;Many data lines&quot;,
    &quot;style&quot;: &quot;{font-size: 20px; color:#0000ff; font-family: Verdana; text-align: center;}&quot;
  },
&nbsp;
  &quot;y_legend&quot;:{
    &quot;text&quot;: &quot;Open Flash Chart&quot;,
    &quot;style&quot;: &quot;{color: #736AFF; font-size: 12px;}&quot;
  },
&nbsp;
  &quot;elements&quot;:[
    {
      &quot;type&quot;:      &quot;bar&quot;,
      &quot;alpha&quot;:     0.5,
      &quot;colour&quot;:    &quot;#9933CC&quot;,
      &quot;text&quot;:      &quot;Page views&quot;,
      &quot;font-size&quot;: 10,
      &quot;values&quot; :   [9,6,7,9,5,7,6,9,7]
    },
    {
      &quot;type&quot;:      &quot;bar&quot;,
      &quot;alpha&quot;:     0.5,
      &quot;colour&quot;:    &quot;#CC9933&quot;,
      &quot;text&quot;:      &quot;Page views 2&quot;,
      &quot;font-size&quot;: 10,
      &quot;values&quot; :   [6,7,9,5,7,6,9,7,3]
    }
  ],
&nbsp;
  &quot;x_axis&quot;:{
    &quot;stroke&quot;:1,
    &quot;tick_height&quot;:10,
    &quot;colour&quot;:&quot;#d000d0&quot;,
    &quot;grid_colour&quot;:&quot;#00ff00&quot;,
    &quot;labels&quot;: [&quot;January&quot;,&quot;February&quot;,&quot;March&quot;,&quot;April&quot;,&quot;May&quot;,&quot;June&quot;,&quot;July&quot;,&quot;August&quot;,&quot;Spetember&quot;]
   },
&nbsp;
  &quot;y_axis&quot;:{
    &quot;stroke&quot;:      4,
    &quot;tick_length&quot;: 3,
    &quot;colour&quot;:      &quot;#d000d0&quot;,
    &quot;grid_colour&quot;: &quot;#00ff00&quot;,
    &quot;offset&quot;:      0,
    &quot;max&quot;:         20
  }
}</pre></td></tr></table></div>

<p>&#160;</p>
<p>可以新建一个文本文档，把上面的内容复制进去，然后重命名为data.json。</p>
<p>现在数据也有了，那怎么把数据放到网页的flash图表里去呢，有一个最简单的方法，有两个步骤：</p>
<ul>
<li><font color="#35383d">把data.json和chart.html放在同级目录下。</font> </li>
<li><font color="#35383d">在URL后面加上”?ofc=data.json”,比如：www.mojojo.org/chart.html?ofc=data.json。</font> </li>
</ul>
<p>现在看看，是不是可以看到了呢？</p>
<p>&#160;</p>
<p>原文：<a title="http://teethgrinder.co.uk/open-flash-chart-2/tutorial.php" href="http://teethgrinder.co.uk/open-flash-chart-2/tutorial.php">http://teethgrinder.co.uk/open-flash-chart-2/tutorial.php</a></p>]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/ofc-tutorial-how-it-works.html/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Reflector</title>
		<link>http://www.datavisualization.cn/index.php/reflector.html</link>
		<comments>http://www.datavisualization.cn/index.php/reflector.html#comments</comments>
		<pubDate>Fri, 13 Feb 2009 08:44:01 +0000</pubDate>
		<dc:creator>mojojo</dc:creator>
				<category><![CDATA[Flex]]></category>
		<category><![CDATA[degrafa]]></category>
		<category><![CDATA[Reflector]]></category>

		<guid isPermaLink="false">http://www.mojojo.org/index.php/reflector.html</guid>
		<description><![CDATA[一个Flex倒影组件的源代码，效果很不错。我用的时候有个bug，总感觉倒影的绘制迟钝那么几分钟，可能是我哪方面的知识还没有掌握到吧。
<a href="http://www.rictus.com/flex/LiveReflection/LiveReflection.html" target="_blank">Demo</a>
<a href="http://www.mojojo.org/wp-content/uploads/2009/02/image1.png" rel="lightbox[109]"><img style="display: inline<br/>... ]]></description>
			<content:encoded><![CDATA[<p>一个Flex倒影组件的源代码，效果很不错。我用的时候有个bug，总感觉倒影的绘制迟钝那么几分钟，可能是我哪方面的知识还没有掌握到吧。</p>
<p><a href="http://www.rictus.com/flex/LiveReflection/LiveReflection.html" target="_blank">Demo</a></p>
<p><a href="http://www.mojojo.org/wp-content/uploads/2009/02/image1.png" rel="lightbox[109]"><img style="display: inline; border-width: 0px;" title="reflector" src="http://www.mojojo.org/wp-content/uploads/2009/02/image-thumb.png" border="0" alt="reflector" width="326" height="187" /></a></p>
<p>下面的图片是<a href="http://www.degrafa.org/source/CapacityIndicator/CapacityIndicator.html" target="_blank">degrafa</a>的一个例子,使用到了reflector的效果。</p>
<p><a href="http://www.mojojo.org/wp-content/uploads/2009/02/image.png" rel="lightbox[109]"><img style="display: inline; border: 0px initial initial;" title="degrafa" src="http://www.mojojo.org/wp-content/uploads/2009/02/image.png" border="0" alt="degrafa" width="531" height="120" /></a></p>
<p>作者博客：<a href="http://www.rictus.com/muchado/" target="_blank">much ado about something</a></p>
<p><span style="color: #004040;"> (作者最近有更新，有需要的可以留意一下)</span></p>
<p><a href="http://www.mojojo.org/wp-download/LiveReflection.zip" target="_blank">下载源码</a></p>

<div class="wp_codebox_msgheader wp_codebox_hide"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00"></span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p109code12'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p10912"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
</pre></td><td class="code" id="p109code12"><pre class="actionscript" style="font-family:monospace;">package com.<span style="color: #006600;">rictus</span>.<span style="color: #006600;">reflector</span>
<span style="color: #66cc66;">&#123;</span>
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">BitmapData</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">GradientType</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">display</span>.<span style="color: #006600;">Sprite</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">events</span>.<span style="color: #006600;">Event</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Matrix</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Point</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">geom</span>.<span style="color: #006600;">Rectangle</span>;
&nbsp;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">core</span>.<span style="color: #006600;">UIComponent</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">FlexEvent</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">MoveEvent</span>;
	<span style="color: #0066CC;">import</span> mx.<span style="color: #006600;">events</span>.<span style="color: #006600;">ResizeEvent</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">BlurFilter</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">BitmapFilter</span>;
	<span style="color: #0066CC;">import</span> flash.<span style="color: #006600;">filters</span>.<span style="color: #006600;">BitmapFilterQuality</span>;
&nbsp;
	<span style="color: #808080; font-style: italic;">/**
	 * A component that displays a reflection below another component.
	 * The reflection is &quot;live&quot;--as the other component's display updates,
	 * the reflection updates as well.  The reflection automatically positions
	 * itself below the target component (so it only works if the target
	 * component's container is absolutely positioned, like a Canvas or a
	 * Panel with layout=&quot;absolute&quot;).
	 *
	 * Typically, you'll want to set a low alpha on the Reflector component (0.3
	 * would be a good default).
	 *
	 * Author: Narciso Jaramillo, nj_flex@rictus.com
	 */</span>
	<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Reflector <span style="color: #0066CC;">extends</span> UIComponent
	<span style="color: #66cc66;">&#123;</span>
		<span style="color: #808080; font-style: italic;">// The component we're reflecting.</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> <span style="color: #0066CC;">_target</span>: UIComponent;
&nbsp;
		<span style="color: #808080; font-style: italic;">// Cached bitmap data objects.  We store these to avoid reallocating</span>
		<span style="color: #808080; font-style: italic;">// bitmap data every time the target redraws.</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _alphaGradientBitmap: BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _targetBitmap: BitmapData;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _resultBitmap: BitmapData;
&nbsp;
		<span style="color: #808080; font-style: italic;">// The current falloff value (see the description of the falloff property).</span>
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _falloff: <span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0.6</span>;
&nbsp;
        <span style="color: #808080; font-style: italic;">// the current blur value</span>
        <span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">var</span> _blurAmount:<span style="color: #0066CC;">Number</span> = <span style="color: #cc66cc;">0.5</span>;
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		 * The UIComponent that you want to reflect.  Should be in an absolutely-
		 * positioned container.  The reflector will automatically position itself
		 * beneath the target.
		 */</span>
		<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> <span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: UIComponent <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #0066CC;">_target</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> <span style="color: #0066CC;">target</span><span style="color: #66cc66;">&#40;</span>value: UIComponent<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_target</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #808080; font-style: italic;">// Remove our listeners from the previous target.</span>
				<span style="color: #0066CC;">_target</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>FlexEvent.<span style="color: #006600;">UPDATE_COMPLETE</span>, handleTargetUpdate, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #0066CC;">_target</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>MoveEvent.<span style="color: #006600;">MOVE</span>, handleTargetMove<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #0066CC;">_target</span>.<span style="color: #006600;">removeEventListener</span><span style="color: #66cc66;">&#40;</span>ResizeEvent.<span style="color: #006600;">RESIZE</span>, handleTargetResize<span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #808080; font-style: italic;">// Clear our bitmaps, so we regenerate them next time a component is targeted.</span>
				clearCachedBitmaps<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
&nbsp;
			<span style="color: #0066CC;">_target</span> = value;
&nbsp;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_target</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #808080; font-style: italic;">// Register to get notified whenever the target is redrawn.  We pass &quot;true&quot;</span>
				<span style="color: #808080; font-style: italic;">// for useCapture here so we can detect when any descendants of the target are</span>
				<span style="color: #808080; font-style: italic;">// redrawn as well.</span>
				<span style="color: #0066CC;">_target</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>FlexEvent.<span style="color: #006600;">UPDATE_COMPLETE</span>, handleTargetUpdate, <span style="color: #000000; font-weight: bold;">true</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #808080; font-style: italic;">// Register to get notified whenever the target moves or resizes.</span>
				<span style="color: #0066CC;">_target</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>MoveEvent.<span style="color: #006600;">MOVE</span>, handleTargetMove<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #0066CC;">_target</span>.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>ResizeEvent.<span style="color: #006600;">RESIZE</span>, handleTargetResize<span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #808080; font-style: italic;">// Position ourselves correctly.</span>
				handleMove<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				handleResize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #808080; font-style: italic;">// Mark ourselves dirty so we get redrawn at the next opportunity.</span>
				invalidateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #808080; font-style: italic;">/**
		 * How much of the component to reflect, between 0 and 1; 0 means not to
		 * reflect any of the component, while 1 means to reflect the entire
		 * component.  The default is 0.6.
		 */</span>
		<span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> falloff<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">return</span> _falloff;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> falloff<span style="color: #66cc66;">&#40;</span>value: <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			_falloff = value;
			handleResize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #66cc66;">&#91;</span>Bindable<span style="color: #66cc66;">&#93;</span>
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">get</span> blurAmount<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">Number</span> <span style="color: #66cc66;">&#123;</span>
            <span style="color: #b1b100;">return</span> _blurAmount;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
        <span style="color: #0066CC;">public</span> <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #0066CC;">set</span> blurAmount<span style="color: #66cc66;">&#40;</span>value: <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
            _blurAmount = value;
            handleResize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
        <span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleTargetUpdate<span style="color: #66cc66;">&#40;</span>event: FlexEvent<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// The target has been redrawn, so mark ourselves for redraw.</span>
			invalidateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleTargetMove<span style="color: #66cc66;">&#40;</span>event: MoveEvent<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			handleMove<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleTargetResize<span style="color: #66cc66;">&#40;</span>event: ResizeEvent<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			handleResize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleResize<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// Since the target is resizing or the falloff is changing, we have</span>
			<span style="color: #808080; font-style: italic;">// to recreate our bitmaps in addition to redrawing and resizing ourselves.</span>
			clearCachedBitmaps<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_target</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #0066CC;">width</span> = <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">width</span>;
				<span style="color: #0066CC;">height</span> = <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff;
				handleMove<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				invalidateDisplayList<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> handleMove<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// Move to be immediately below the target.  We don't need to</span>
			<span style="color: #808080; font-style: italic;">// redraw ourselves in this case.</span>
			move<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_target</span>.<span style="color: #006600;">x</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #006600;">y</span> + <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		override protected <span style="color: #000000; font-weight: bold;">function</span> updateDisplayList<span style="color: #66cc66;">&#40;</span>unscaledWidth: <span style="color: #0066CC;">Number</span>, unscaledHeight: <span style="color: #0066CC;">Number</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #808080; font-style: italic;">// This function is called by the framework at some point after invalidateDisplayList() is called.</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_target</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&amp;</span>amp;<span style="color: #66cc66;">&amp;</span>amp; <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff <span style="color: #66cc66;">&amp;</span>gt;= <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #808080; font-style: italic;">// Create our cached bitmap data objects if they haven't been created already.</span>
				createBitmaps<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_target</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #000000; font-weight: bold;">var</span> rect: Rectangle = <span style="color: #000000; font-weight: bold;">new</span> Rectangle<span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff<span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #808080; font-style: italic;">// Draw the bottom part of the target component into the target bitmap, flipped upside down.</span>
				<span style="color: #000000; font-weight: bold;">var</span> flipTransform: Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				flipTransform.<span style="color: #006600;">scale</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">1</span>, -<span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span>;
				flipTransform.<span style="color: #006600;">translate</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
				_targetBitmap.<span style="color: #006600;">fillRect</span><span style="color: #66cc66;">&#40;</span>rect, 0x00000000<span style="color: #66cc66;">&#41;</span>;
				_targetBitmap.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">_target</span>, flipTransform<span style="color: #66cc66;">&#41;</span>;
&nbsp;
				<span style="color: #808080; font-style: italic;">// Combine the target image with the alpha gradient to produce the reflection image.</span>
				_resultBitmap.<span style="color: #006600;">fillRect</span><span style="color: #66cc66;">&#40;</span>rect, 0x00000000<span style="color: #66cc66;">&#41;</span>;
				_resultBitmap.<span style="color: #006600;">copyPixels</span><span style="color: #66cc66;">&#40;</span>_targetBitmap, rect, <span style="color: #000000; font-weight: bold;">new</span> Point<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>, _alphaGradientBitmap<span style="color: #66cc66;">&#41;</span>;
&nbsp;
                <span style="color: #808080; font-style: italic;">// And blur it</span>
                graphics.<span style="color: #0066CC;">beginFill</span><span style="color: #66cc66;">&#40;</span>0xFFCC00<span style="color: #66cc66;">&#41;</span>;
                graphics.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">height</span><span style="color: #66cc66;">&#41;</span>;
                graphics.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #000000; font-weight: bold;">var</span> filter:BitmapFilter = <span style="color: #000000; font-weight: bold;">new</span> BlurFilter<span style="color: #66cc66;">&#40;</span>_blurAmount<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">5</span>, _blurAmount<span style="color: #66cc66;">*</span><span style="color: #cc66cc;">10</span>, BitmapFilterQuality.<span style="color: #006600;">HIGH</span><span style="color: #66cc66;">&#41;</span>;
                <span style="color: #000000; font-weight: bold;">var</span> myFilters:<span style="color: #0066CC;">Array</span> = <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #0066CC;">Array</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
                myFilters.<span style="color: #0066CC;">push</span><span style="color: #66cc66;">&#40;</span>filter<span style="color: #66cc66;">&#41;</span>;
                filters = myFilters;            
&nbsp;
				<span style="color: #808080; font-style: italic;">// Finally, copy the resulting bitmap into our own graphic context.</span>
				graphics.<span style="color: #0066CC;">clear</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
				graphics.<span style="color: #006600;">beginBitmapFill</span><span style="color: #66cc66;">&#40;</span>_resultBitmap, <span style="color: #000000; font-weight: bold;">null</span>, <span style="color: #000000; font-weight: bold;">false</span><span style="color: #66cc66;">&#41;</span>;
				graphics.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">_target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff<span style="color: #66cc66;">&#41;</span>;
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> clearCachedBitmaps<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			_alphaGradientBitmap = <span style="color: #000000; font-weight: bold;">null</span>;
			_targetBitmap = <span style="color: #000000; font-weight: bold;">null</span>;
			_resultBitmap = <span style="color: #000000; font-weight: bold;">null</span>;
		<span style="color: #66cc66;">&#125;</span>
&nbsp;
		<span style="color: #0066CC;">private</span> <span style="color: #000000; font-weight: bold;">function</span> createBitmaps<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>: UIComponent<span style="color: #66cc66;">&#41;</span>: <span style="color: #0066CC;">void</span> <span style="color: #66cc66;">&#123;</span>
			<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span> <span style="color: #66cc66;">!</span>= <span style="color: #000000; font-weight: bold;">null</span> <span style="color: #66cc66;">&amp;</span>amp;<span style="color: #66cc66;">&amp;</span>amp; <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff <span style="color: #66cc66;">&amp;</span>gt;= <span style="color: #cc66cc;">1</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_alphaGradientBitmap == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #808080; font-style: italic;">// Create and store an alpha gradient.  Whenever we redraw, this will be combined</span>
					<span style="color: #808080; font-style: italic;">// with an image of the target component to create the &quot;fadeout&quot; effect.</span>
					_alphaGradientBitmap = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff, <span style="color: #000000; font-weight: bold;">true</span>, 0x00000000<span style="color: #66cc66;">&#41;</span>;
					<span style="color: #000000; font-weight: bold;">var</span> gradientMatrix: Matrix = <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
					<span style="color: #000000; font-weight: bold;">var</span> gradientSprite: Sprite = <span style="color: #000000; font-weight: bold;">new</span> Sprite<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
					gradientMatrix.<span style="color: #006600;">createGradientBox</span><span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff, <span style="color: #0066CC;">Math</span>.<span style="color: #0066CC;">PI</span><span style="color: #66cc66;">/</span><span style="color: #cc66cc;">2</span>,
						<span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#41;</span>;
					gradientSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">beginGradientFill</span><span style="color: #66cc66;">&#40;</span>GradientType.<span style="color: #006600;">LINEAR</span>, <span style="color: #66cc66;">&#91;</span>0xFFFFFF, 0xFFFFFF<span style="color: #66cc66;">&#93;</span>,
						<span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">1</span>, <span style="color: #cc66cc;">0</span><span style="color: #66cc66;">&#93;</span>, <span style="color: #66cc66;">&#91;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">255</span><span style="color: #66cc66;">&#93;</span>, gradientMatrix<span style="color: #66cc66;">&#41;</span>;
					gradientSprite.<span style="color: #006600;">graphics</span>.<span style="color: #006600;">drawRect</span><span style="color: #66cc66;">&#40;</span><span style="color: #cc66cc;">0</span>, <span style="color: #cc66cc;">0</span>, <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff<span style="color: #66cc66;">&#41;</span>;
					gradientSprite.<span style="color: #006600;">graphics</span>.<span style="color: #0066CC;">endFill</span><span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
					_alphaGradientBitmap.<span style="color: #006600;">draw</span><span style="color: #66cc66;">&#40;</span>gradientSprite, <span style="color: #000000; font-weight: bold;">new</span> Matrix<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_targetBitmap == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #808080; font-style: italic;">// Create a bitmap to hold the target's image.  This is updated every time</span>
					<span style="color: #808080; font-style: italic;">// we're redrawn in updateDisplayList().</span>
					_targetBitmap = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff, <span style="color: #000000; font-weight: bold;">true</span>, 0x00000000<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
				<span style="color: #b1b100;">if</span> <span style="color: #66cc66;">&#40;</span>_resultBitmap == <span style="color: #000000; font-weight: bold;">null</span><span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
					<span style="color: #808080; font-style: italic;">// Create a bitmap to hold the reflected image.  This is updated every time</span>
					<span style="color: #808080; font-style: italic;">// we're redrawn in updateDisplayList().</span>
					_resultBitmap = <span style="color: #000000; font-weight: bold;">new</span> BitmapData<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">width</span>, <span style="color: #0066CC;">target</span>.<span style="color: #0066CC;">height</span> <span style="color: #66cc66;">*</span> _falloff, <span style="color: #000000; font-weight: bold;">true</span>, 0x00000000<span style="color: #66cc66;">&#41;</span>;
				<span style="color: #66cc66;">&#125;</span>
			<span style="color: #66cc66;">&#125;</span>
		<span style="color: #66cc66;">&#125;</span>
	<span style="color: #66cc66;">&#125;</span>
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>
]]></content:encoded>
			<wfw:commentRss>http://www.datavisualization.cn/index.php/reflector.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
