<?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>Riaelite&#039;s Blog</title>
	<atom:link href="http://www.riaelite.com/blog/index.php?feed=rss2" rel="self" type="application/rss+xml" />
	<link>http://www.riaelite.com/blog</link>
	<description>Rich Internet Application Elite</description>
	<lastBuildDate>Fri, 03 Sep 2010 01:37:03 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>AS3 获取loader载入的SWF的帧数</title>
		<link>http://www.riaelite.com/blog/?p=289</link>
		<comments>http://www.riaelite.com/blog/?p=289#comments</comments>
		<pubDate>Fri, 03 Sep 2010 01:37:03 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Flash/As3]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=289</guid>
		<description><![CDATA[
通过以下代码:
		MovieClip(e.currentTarget.loader.content)totalFrames
		该方法要求载入的swf的as版本必须是as3.0 的,不然后引发类型转换出错.
得到帧数.后.通过以下代码可以让载入的影片播放一次后删除掉
		stage.addChild(e.currentTarget.loader);
		var tempMovie:MovieClip = e.currentTarget.loader.content as MovieClip;
		tempMovie.addFrameScript(tempMovie.totalFrames-1,function(){stage.removeChild(e.currentTarget.loader)});
		addFrameScript 加入到指定帧的代码,加入后,会一直存在该实例上,不会执行一次后清除&#8230;
		例如再次 stage.addChild(loader);上次被附加至帧上的代码将会再次执行.

]]></description>
			<content:encoded><![CDATA[<div class="entry-body nerr">
<p>通过以下代码:<br />
		MovieClip(e.currentTarget.loader.content)totalFrames<br />
		该方法要求载入的swf的as版本必须是as3.0 的,不然后引发类型转换出错.</p>
<p>得到帧数.后.通过以下代码可以让载入的影片播放一次后删除掉<br />
		stage.addChild(e.currentTarget.loader);<br />
		var tempMovie:MovieClip = e.currentTarget.loader.content as MovieClip;<br />
		tempMovie.addFrameScript(tempMovie.totalFrames-1,function(){stage.removeChild(e.currentTarget.loader)});</p>
<p>		addFrameScript 加入到指定帧的代码,加入后,会一直存在该实例上,不会执行一次后清除&#8230;<br />
		例如再次 stage.addChild(loader);上次被附加至帧上的代码将会再次执行.</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=289</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>[FlashPlayer10]在本地保存数据</title>
		<link>http://www.riaelite.com/blog/?p=285</link>
		<comments>http://www.riaelite.com/blog/?p=285#comments</comments>
		<pubDate>Tue, 31 Aug 2010 11:38:40 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Flash/As3]]></category>
		<category><![CDATA[FileReference]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=285</guid>
		<description><![CDATA[FlashPlayer10的FileReference增加了save方法，可以把数据保存在本地
ACTIONSCRIPT3&#160;&#160;show/hide





1
2
3
4



import flash.net.FileReference;
var saveTxt:String=&#34;this is a test&#34;;
var file:FileReference = new FileReference();
file.save(saveTxt, &#34;savetest.txt&#34;);





用法很简单啦
]]></description>
			<content:encoded><![CDATA[<p>FlashPlayer10的FileReference增加了save方法，可以把数据保存在本地</p>
<div class="wp_syntaxhead"><strong>ACTIONSCRIPT3</strong>&nbsp;&nbsp;<a href="javascript:showSWF('wp_syntax_id_1');">show/hide</a></div>
<div class="wp_syntax" id="wp_syntax_id_1">
<table>
<tbody>
<tr>
<td class="line_numbers">
<pre>1
2
3
4
</pre>
</td>
<td class="code">
<pre class="actionscript3" style="font-family: monospace;"><span style="color: rgb(0, 51, 255); font-weight: bold;">import</span> <span style="color: rgb(0, 73, 147);">flash.net</span>.<span style="color: rgb(0, 73, 147);">FileReference</span>;
<span style="color: rgb(102, 153, 204); font-weight: bold;">var</span> saveTxt<span style="color: rgb(0, 0, 0); font-weight: bold;">:</span><span style="color: rgb(0, 73, 147);">String</span>=<span style="color: rgb(153, 0, 0);">&quot;this is a test&quot;</span>;
<span style="color: rgb(102, 153, 204); font-weight: bold;">var</span> file<span style="color: rgb(0, 0, 0); font-weight: bold;">:</span><span style="color: rgb(0, 73, 147);">FileReference</span> = <span style="color: rgb(0, 51, 255); font-weight: bold;">new</span> <span style="color: rgb(0, 73, 147);">FileReference</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">)</span>;
file.<span style="color: rgb(0, 73, 147);">save</span><span style="color: rgb(0, 0, 0);">(</span>saveTxt, <span style="color: rgb(153, 0, 0);">&quot;savetest.txt&quot;</span><span style="color: rgb(0, 0, 0);">)</span>;</pre>
</td>
</tr>
</tbody>
</table>
</div>
<p>用法很简单啦</p>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=285</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Flash loading动画</title>
		<link>http://www.riaelite.com/blog/?p=257</link>
		<comments>http://www.riaelite.com/blog/?p=257#comments</comments>
		<pubDate>Thu, 26 Aug 2010 03:11:41 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Design Art]]></category>
		<category><![CDATA[loading]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=257</guid>
		<description><![CDATA[flash网站有个漂亮的loading动画可以说是起到一定的出彩，这个网站是专门收集loading的
http://www.prettyloaded.com/
]]></description>
			<content:encoded><![CDATA[<p>flash网站有个漂亮的loading动画可以说是起到一定的出彩，这个网站是专门收集loading的</p>
<p><a href="http://www.prettyloaded.com/">http://www.prettyloaded.com/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=257</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>使textField的文字变透明</title>
		<link>http://www.riaelite.com/blog/?p=193</link>
		<comments>http://www.riaelite.com/blog/?p=193#comments</comments>
		<pubDate>Fri, 04 Jun 2010 12:09:45 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Flash/As3]]></category>
		<category><![CDATA[AS3工具类]]></category>
		<category><![CDATA[TestField]]></category>
		<category><![CDATA[透明]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=193</guid>
		<description><![CDATA[var txt:TextField = new TextField();
txt.blendMode = BlendMode.LAYER;
txt.alpha = .2;
txt.appendText(&#34;这里文字透明咯~&#34;);
 addChild(txt);
]]></description>
			<content:encoded><![CDATA[<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> txt:<span style="color: rgb(0, 102, 204);">TextField</span> = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> <span style="color: rgb(0, 102, 204);">TextField</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
txt.<span style="color: rgb(0, 102, 0);">blendMode</span> = BlendMode.<span style="color: rgb(0, 102, 0);">LAYER</span>;
txt.<span style="color: rgb(0, 102, 0);">alpha</span> = .2;
txt.<span style="color: rgb(0, 102, 0);">appendText</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;这里文字透明咯~&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
 addChild<span style="color: rgb(102, 204, 102);">(</span>txt<span style="color: rgb(102, 204, 102);">)</span>;</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=193</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>as3中的监听事件如何传参数</title>
		<link>http://www.riaelite.com/blog/?p=191</link>
		<comments>http://www.riaelite.com/blog/?p=191#comments</comments>
		<pubDate>Mon, 03 May 2010 08:03:45 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Flash/As3]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=191</guid>
		<description><![CDATA[在AS3中，监听事件，比如：
	**.addEventListener(Event.COMPLETE,hander);
	function hander(event:Event):void
很多时候要向这个hander方法里传递参数。使程序更灵活。
下面有一个简单的方法：
**.addEventListener(Event.ENTER_FRAME,function(e:Event){ hander2(e,12，6); });//比如要传&#8220;12&#8221;&#8220;6&#8221;这个参数
hander2如下：
function hander2(event:Event,i:int,j:int):void {
 if ((event.target as  MovieClip).currentFrame == i) {
  event.target.gotoAndPlay(j);
&#160;
 }
}
]]></description>
			<content:encoded><![CDATA[<p>在AS3中，监听事件，比如：<br />
	**.addEventListener(Event.COMPLETE,hander);<br />
	function hander(event:Event):void</p>
<p>很多时候要向这个hander方法里传递参数。使程序更灵活。</p>
<p>下面有一个简单的方法：</p>
<pre class="actionscript" style="font-family: monospace;"><span style="color: rgb(102, 204, 102);">**</span>.<span style="color: rgb(0, 102, 0);">addEventListener</span><span style="color: rgb(102, 204, 102);">(</span>Event.<span style="color: rgb(0, 102, 0);">ENTER_FRAME</span>,<span style="font-weight: bold; color: rgb(0, 0, 0);">function</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>:Event<span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">{</span> hander2<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>,<span style="color: rgb(204, 102, 204);">12</span>，<span style="color: rgb(204, 102, 204);">6</span><span style="color: rgb(102, 204, 102);">)</span>; <span style="color: rgb(102, 204, 102);">}</span><span style="color: rgb(102, 204, 102);">)</span>;<span style="color: rgb(128, 128, 128); font-style: italic;">//比如要传&ldquo;12&rdquo;&ldquo;6&rdquo;这个参数</span>
hander2如下：
<span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> hander2<span style="color: rgb(102, 204, 102);">(</span>event:Event,i:<span style="color: rgb(0, 102, 204);">int</span>,j:<span style="color: rgb(0, 102, 204);">int</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
 <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span>event.<span style="color: rgb(0, 102, 204);">target</span> as  <span style="color: rgb(0, 102, 204);">MovieClip</span><span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 0);">currentFrame</span> == i<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
  event.<span style="color: rgb(0, 102, 204);">target</span>.<span style="color: rgb(0, 102, 204);">gotoAndPlay</span><span style="color: rgb(102, 204, 102);">(</span>j<span style="color: rgb(102, 204, 102);">)</span>;
&nbsp;
 <span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=191</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScript3读取XML</title>
		<link>http://www.riaelite.com/blog/?p=184</link>
		<comments>http://www.riaelite.com/blog/?p=184#comments</comments>
		<pubDate>Wed, 28 Apr 2010 11:05:18 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Flash/As3]]></category>
		<category><![CDATA[ActionScript3，xml]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=184</guid>
		<description><![CDATA[正文：
对于如下的一个XML文档，在flash中应该怎么读呢？

(图片来自kirupa.com)
按照Using XML in Flash CS3/AS3上的内容，包括了XML结构介绍等内容，在此我不再转述，对XML不怎么了解的话请先移步：XML 系列教程。
这里我分三步描述flash读XML的基本方法，以及外延一个对带命名空间的XML的读取方法，如下目录：
1、加载XML文件；
	2、读取XML的数据；
	3、过滤数据；
	4、读取带命名空间的XML数据；
	5、处理gb2312编码的XML；
注：在这里的AS脚本都是在 Adobe Flash CS3 版本以上中进行编写，flex用户请自行添加修改相应的包引用。
下面开始第一部分，如何加载XML文件！
1、加载XML文件
在脚本编辑器中写入以下代码：


var xmlLoader:URLLoader = new URLLoader();
var xmlData:XML = null;
&#160;
xmlLoader.addEventListener(Event.COMPLETE, LoadXML);
xmlLoader.load(new URLRequest(&#34;http://www.kirupa.com/net/files/sampleXML.xml&#34;));
&#160;
function LoadXML(e:Event):void {
  xmlData = new XML(e.target.data);
  trace(xmlData);
}
&#160;


按Ctrl+Enter运行它，你会在输出窗口中看到整个XML的内容：
	
	这里不进行代码解说，关于XML类，请查看：http://help.adobe.com/zh_TW/AS3LCR/Flash_10.0/XML.html
下面进入第2部分：如何读取XML数据。
2、读取XML数据
2.1直接读取XML数据
对XML数据的读取是十分简单的，不信请看：


function LoadXML(e:Event):void {
  xmlData = new XML(e.target.data);
  ParseBooks(xmlData);
}
&#160;
function ParseBooks(bookInput:XML):void {
  trace(&#34;XML Output&#34;);
  trace(&#34;------------------------&#34;);
  trace(bookInput.Book);
}
&#160;


可得到如何结果：


XML Output
------------------------
&#160;
  Sir Arthur Conan Doyle
&#160;
  F. Scott [...]]]></description>
			<content:encoded><![CDATA[<p><strong>正文：</strong></p>
<p>对于如下的一个XML文档，在flash中应该怎么读呢？</p>
<p><a href="http://www.kirupa.com/net/images/xml_doc2.gif"><img alt="" class="alignnone" height="274" src="http://www.kirupa.com/net/images/xml_doc2.gif" title="XML样例" width="363" /></a></p>
<p>(图片来自kirupa.com)</p>
<p>按照<a href="http://www.kirupa.com/developer/flashcs3/using_xml_as3_pg1.htm">Using XML in Flash CS3/AS3</a>上的内容，包括了XML结构介绍等内容，在此我不再转述，对XML不怎么了解的话请先移步：<a href="http://www.w3school.com.cn/x.asp">XML 系列教程</a>。</p>
<p>这里我分三步描述flash读XML的基本方法，以及外延一个对带命名空间的XML的读取方法，如下目录：</p>
<p>1、加载XML文件；<br />
	2、读取XML的数据；<br />
	3、过滤数据；<br />
	4、读取带命名空间的XML数据；<br />
	5、处理gb2312编码的XML；</p>
<p>注：在这里的AS脚本都是在 Adobe Flash CS3 版本以上中进行编写，flex用户请自行添加修改相应的包引用。</p>
<p>下面开始第一部分，如何加载XML文件！</p>
<h3>1、加载XML文件</h3>
<p>在脚本编辑器中写入以下代码：</p>
<div class="wp_syntax" style="padding-bottom: 15px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> xmlLoader:URLLoader = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> URLLoader<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
<span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> xmlData:<span style="color: rgb(0, 102, 204);">XML</span> = <span style="font-weight: bold; color: rgb(0, 0, 0);">null</span>;
&nbsp;
xmlLoader.<span style="color: rgb(0, 102, 0);">addEventListener</span><span style="color: rgb(102, 204, 102);">(</span>Event.<span style="color: rgb(0, 102, 0);">COMPLETE</span>, LoadXML<span style="color: rgb(102, 204, 102);">)</span>;
xmlLoader.<span style="color: rgb(0, 102, 204);">load</span><span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> URLRequest<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;http://www.kirupa.com/net/files/sampleXML.xml&quot;</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;
&nbsp;
<span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> LoadXML<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>:Event<span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  xmlData = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> <span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>.<span style="color: rgb(0, 102, 204);">target</span>.<span style="color: rgb(0, 102, 204);">data</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>xmlData<span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>按Ctrl+Enter运行它，你会在输出窗口中看到整个XML的内容：<br />
	<img alt="输出窗口" src="http://www.kirupa.com/developer/flashcs3/images/xmlOutputWindow.png" /><br />
	这里不进行代码解说，关于XML类，请查看：http://help.adobe.com/zh_TW/AS3LCR/Flash_10.0/XML.html</p>
<p>下面进入第2部分：如何读取XML数据。</p>
<h3>2、读取XML数据</h3>
<h4>2.1直接读取XML数据</h4>
<p>对XML数据的读取是十分简单的，不信请看：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> LoadXML<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>:Event<span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  xmlData = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> <span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>.<span style="color: rgb(0, 102, 204);">target</span>.<span style="color: rgb(0, 102, 204);">data</span><span style="color: rgb(102, 204, 102);">)</span>;
  ParseBooks<span style="color: rgb(102, 204, 102);">(</span>xmlData<span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}</span>
&nbsp;
<span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookInput.<span style="color: rgb(0, 102, 0);">Book</span><span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>可得到如何结果：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="xml" style="font-family: monospace;">XML Output
------------------------
&nbsp;
  Sir Arthur Conan Doyle
&nbsp;
  F. Scott Fitzgerald
&nbsp;
  Stephen E. Ambrose
&nbsp;
  Stephen E. Ambrose</pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>同样的，把trace的内容改为bookInput.Book.author，会得到下面的结果：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="xml" style="font-family: monospace;">XML Output
------------------------
Sir Arthur Conan Doyle
F. Scott Fitzgerald
Stephen E. Ambrose
Stephen E. Ambrose</pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>而trace(bookInput.Book.author.text());可得到：</p>
<div class="wp_syntax" style="padding-bottom: 15px;">
<div class="code">
<pre class="xml" style="font-family: monospace;">XML Output
------------------------
Sir Arthur Conan DoyleF. Scott FitzgeraldStephen E. AmbroseStephen E. Ambrose</pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>同样的，要读具体的节点，可以这样</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 0);">author</span>.<span style="color: rgb(0, 102, 204);">text</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">[</span><span style="color: rgb(204, 102, 204);">0</span><span style="color: rgb(102, 204, 102);">]</span><span style="color: rgb(102, 204, 102);">)</span>;</pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>可得到</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="xml" style="font-family: monospace;">XML Output
------------------------
Sir Arthur Conan Doyle</pre>
<p>&nbsp;</p>
</p></div>
</div>
<h4>2.2、XML和XMLList</h4>
<p>这里我们会用到另外一个类XMLList，这个类可以把XML对象作为数组的方式读取，可以方便地进行for each操作。</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> authorList:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 0);">author</span>;
  <span style="color: rgb(177, 177, 0);">for</span> each <span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> authorElement:<span style="color: rgb(0, 102, 204);">XML</span> <span style="color: rgb(177, 177, 0);">in</span> authorList<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>authorElement<span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<h4>&nbsp;2.3历遍子元素</h4>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookChildren:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 0);">children</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(177, 177, 0);">for</span> each <span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookInfo:<span style="color: rgb(0, 102, 204);">XML</span> <span style="color: rgb(177, 177, 0);">in</span> bookChildren<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookInfo<span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>结果如下：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="xml" style="font-family: monospace;">XML Output
------------------------
Sherlock Holmes: Complete Novels and Stories, Vol 1
Sir Arthur Conan Doyle
The Great Gatsby
F. Scott Fitzgerald
Undaunted Courage
Stephen E. Ambrose
Nothing Like It In the World
Stephen E. Ambrose</pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>同样的，我们可以用节点的.name()方法得知它的标签名：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookChildren:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 0);">children</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(177, 177, 0);">for</span> each <span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookInfo:<span style="color: rgb(0, 102, 204);">XML</span> <span style="color: rgb(177, 177, 0);">in</span> bookChildren<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span>bookInfo.<span style="color: rgb(0, 102, 204);">name</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span> == <span style="color: rgb(255, 0, 0);">&quot;author&quot;</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
      <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookInfo<span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(102, 204, 102);">}</span>
  <span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>这样就可以得到所有author的值了。</p>
<h4>2.4读取属性</h4>
<p>历遍属性的方法：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookAttributes:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 204);">attributes</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(177, 177, 0);">for</span> each <span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookISBN:<span style="color: rgb(0, 102, 204);">XML</span> <span style="color: rgb(177, 177, 0);">in</span> bookAttributes<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookISBN<span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>对于attributes，同样有一个.name()方法：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookAttributes:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 204);">attributes</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(177, 177, 0);">for</span> each <span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookISBN:<span style="color: rgb(0, 102, 204);">XML</span> <span style="color: rgb(177, 177, 0);">in</span> bookAttributes<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(177, 177, 0);">if</span> <span style="color: rgb(102, 204, 102);">(</span>bookISBN.<span style="color: rgb(0, 102, 204);">name</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span> == <span style="color: rgb(255, 0, 0);">&quot;ISBN&quot;</span><span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
      <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookISBN<span style="color: rgb(102, 204, 102);">)</span>;
    <span style="color: rgb(102, 204, 102);">}</span>
  <span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>另外还有一种更直接的方法，直接用.attribute(&ldquo;ISBN&rdquo;) ：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookAttributes:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 0);">attribute</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;ISBN&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(177, 177, 0);">for</span> each <span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookISBN:<span style="color: rgb(0, 102, 204);">XML</span> <span style="color: rgb(177, 177, 0);">in</span> bookAttributes<span style="color: rgb(102, 204, 102);">)</span> <span style="color: rgb(102, 204, 102);">{</span>
    <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookISBN<span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(102, 204, 102);">}</span>
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>注意，这个.attribute(attributeName:*)方法不是.attributes()哦，少了个s的哦。</p>
<h3>3、过滤数据</h3>
<h4>3.1过滤值</h4>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> authorList:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(102, 204, 102);">(</span>author == <span style="color: rgb(255, 0, 0);">&quot;Stephen E. Ambrose&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>authorList<span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>可得到：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="xml" style="font-family: monospace;">XML Output
------------------------
<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;Book</span> <span style="color: rgb(0, 0, 102);">ISBN</span>=<span style="color: rgb(255, 0, 0);">&quot;0684826976&quot;</span><span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Undaunted Courage<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Stephen E. Ambrose<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/Book<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;Book</span> <span style="color: rgb(0, 0, 102);">ISBN</span>=<span style="color: rgb(255, 0, 0);">&quot;0743203178&quot;</span><span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Nothing Like It In the World<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Stephen E. Ambrose<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/Book<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>所以在过滤之后，可以同样使用</p>
<div class="wp_syntax" style="padding-bottom: 15px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> authorList:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(102, 204, 102);">(</span>author == <span style="color: rgb(255, 0, 0);">&quot;Stephen E. Ambrose&quot;</span><span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 0);">title</span>;</pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>得到所有作者是Stephen E. Ambrose的书名了。</p>
<h4>3.2过滤属性</h4>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookList:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">@</span>ISBN == <span style="color: rgb(255, 0, 0);">&quot;0743203178&quot;</span><span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 0);">title</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookList<span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>我们还可以进行一些复杂的过滤：</p>
<div class="wp_syntax" style="padding-bottom: 15px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> bookList:XMLList = bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(102, 204, 102);">(</span>author == <span style="color: rgb(255, 0, 0);">&quot;Stephen E. Ambrose&quot;</span> <span style="color: rgb(102, 204, 102);">&amp;&amp;</span> title <span style="color: rgb(102, 204, 102);">!</span>= <span style="color: rgb(255, 0, 0);">&quot;Nothing Like It In the World&quot;</span><span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 0);">title</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookList<span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<h3>4、读取带命名空间的XML数据</h3>
<p>如果把上面的XML文件改一改，变成如下：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="xml" style="font-family: monospace;"><span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;Books</span> <span style="color: rgb(0, 0, 102);">xmlns:g</span>=<span style="color: rgb(255, 0, 0);">&quot;http://guitarbean.com/&quot;</span><span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;Book</span> <span style="color: rgb(0, 0, 102);">ISBN</span>=<span style="color: rgb(255, 0, 0);">&quot;0553212419&quot;</span><span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Sherlock Holmes: Complete Novels and Stories, Vol 1<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Sir Arthur Conan Doyle<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/Book<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;Book</span> <span style="color: rgb(0, 0, 102);">ISBN</span>=<span style="color: rgb(255, 0, 0);">&quot;0743273567&quot;</span><span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>The Great Gatsby<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>F. Scott Fitzgerald<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/Book<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;Book</span> <span style="color: rgb(0, 0, 102);">ISBN</span>=<span style="color: rgb(255, 0, 0);">&quot;0684826976&quot;</span><span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Undaunted Courage<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Stephen E. Ambrose<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/Book<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;Book</span> <span style="color: rgb(0, 0, 102);">ISBN</span>=<span style="color: rgb(255, 0, 0);">&quot;0743203178&quot;</span><span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Nothing Like It In the World<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/title<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>Stephen E. Ambrose<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/author<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
    <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;g:cost<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>XXXXXXX<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/g:cost<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
  <span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/Book<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span>
<span style="color: rgb(0, 153, 0);"><span style="font-weight: bold; color: rgb(0, 0, 0);">&lt;/Books<span style="font-weight: bold; color: rgb(0, 0, 0);">&gt;</span></span></span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>这时要用到Namespace类了：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> ParseBooks<span style="color: rgb(102, 204, 102);">(</span>bookInput:<span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;XML Output&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;------------------------&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> g:Namespace = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> Namespace<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;http://guitarbean.com/&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>bookInput.<span style="color: rgb(0, 102, 0);">Book</span>.<span style="color: rgb(0, 102, 0);">g</span>::cost<span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}</span></pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>可得到：</p>
<div class="wp_syntax" style="padding-bottom: 0px;">
<div class="code">
<pre class="xml" style="font-family: monospace;">XML Output
------------------------
XXXXXXX</pre>
<p>&nbsp;</p>
</p></div>
</div>
<p>这里的双冒号(::)就是命名空间符，只要建立了一Namespace对象，XML对象便可直接用点运算符来操作了，相对的比较方便。</p>
<h3>5、处理gb2312编码的XML</h3>
<p>有的XML文件可能不是UTF8的，如在中国常用的gb2312编码，侧需要转码一下，这时要用到ByteArray类，在建立XML对象前统一处理下即可：</p>
<div class="wp_syntax" style="padding-bottom: 15px;">
<div class="code">
<pre class="actionscript" style="font-family: monospace;"><span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> xmlLoader:URLLoader = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> URLLoader<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">)</span>;
<span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> xmlData:<span style="color: rgb(0, 102, 204);">XML</span> = <span style="font-weight: bold; color: rgb(0, 0, 0);">null</span>;
&nbsp;
xmlLoader.<span style="color: rgb(0, 102, 0);">addEventListener</span><span style="color: rgb(102, 204, 102);">(</span>Event.<span style="color: rgb(0, 102, 0);">COMPLETE</span>, LoadXML<span style="color: rgb(102, 204, 102);">)</span>;
xmlLoader.<span style="color: rgb(0, 102, 204);">load</span><span style="color: rgb(102, 204, 102);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> URLRequest<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(255, 0, 0);">&quot;http://www.kirupa.com/net/files/sampleXML.xml&quot;</span><span style="color: rgb(102, 204, 102);">)</span><span style="color: rgb(102, 204, 102);">)</span>;
&nbsp;
<span style="font-weight: bold; color: rgb(0, 0, 0);">function</span> LoadXML<span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>:Event<span style="color: rgb(102, 204, 102);">)</span>:<span style="color: rgb(0, 102, 204);">void</span> <span style="color: rgb(102, 204, 102);">{</span>
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> BA:ByteArray = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> ByteArray;
  BA.<span style="color: rgb(0, 102, 0);">writeBytes</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(102, 204, 102);">(</span><span style="color: rgb(0, 102, 204);">e</span>.<span style="color: rgb(0, 102, 204);">target</span> as URLLoader<span style="color: rgb(102, 204, 102);">)</span>.<span style="color: rgb(0, 102, 204);">data</span><span style="color: rgb(102, 204, 102);">)</span>;
  BA.<span style="color: rgb(0, 102, 204);">position</span> = <span style="color: rgb(204, 102, 204);">0</span>;
  <span style="color: rgb(128, 128, 128); font-style: italic;">//把gb2312转为UTF8编码：<font size="2">从字符集中读取字符串</font></span>
  <span style="font-weight: bold; color: rgb(0, 0, 0);">var</span> newData:<span style="color: rgb(0, 102, 204);">String</span> = BA.<span style="color: rgb(0, 102, 0);">readMultiByte</span><span style="color: rgb(102, 204, 102);">(</span>BA.<span style="color: rgb(0, 102, 204);">length</span>,<span style="color: rgb(255, 0, 0);">&quot;gb2312&quot;</span><span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(128, 128, 128); font-style: italic;">//然后才建立XML对象：</span>
  xmlData = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> <span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">(</span>newData<span style="color: rgb(102, 204, 102);">)</span>;
  <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>xmlData<span style="color: rgb(102, 204, 102);">)</span>;
<span style="color: rgb(102, 204, 102);">}
</span></pre>
<p>&nbsp;或写个方法</p>
</p></div>
<p>public&nbsp; function DecodeFrom(_arg1:ByteArray):ByteArray{<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; var _local2:ByteArray;<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _local2 = new ByteArray();<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _arg1.position = 0;<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while (_local2.length &lt; _arg1.length) {<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _local2.writeByte(uint((Number(_arg1.readUnsignedByte()) ^ password)));<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; };<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return (_local2);<br />
		&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }</p>
<p>LoadXML中这样写：</p>
<p>&nbsp;xmlData = <span style="font-weight: bold; color: rgb(0, 0, 0);">new</span> <span style="color: rgb(0, 102, 204);">XML</span><span style="color: rgb(102, 204, 102);">(</span>DecodeFrom(BA<span style="color: rgb(102, 204, 102);">)</span>;<br />
		&nbsp; <span style="color: rgb(0, 102, 204);">trace</span><span style="color: rgb(102, 204, 102);">(</span>xmlData<span style="color: rgb(102, 204, 102);">)</span>;<br />
		&nbsp;</p>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=184</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DIV中图片垂直居中，与图片对齐</title>
		<link>http://www.riaelite.com/blog/?p=188</link>
		<comments>http://www.riaelite.com/blog/?p=188#comments</comments>
		<pubDate>Sun, 25 Apr 2010 09:28:32 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[Div]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=188</guid>
		<description><![CDATA[想让图片和文字垂直居中对齐的话，可以在IMG标签下添加align=absmiddle属性即可实现，但align=absmiddle属性在W3C验证下通不过，但可以用CSS来代替IMG的align=absmiddle属性来实现垂直居中。
	可以在CSS中加入vertical-align:middle;就能实现了


Html代码 


&#60;div&#62;&#160;&#160;
&#160;&#160;&#160;&#160;&#60;img&#160;style=&#34;vertical-align:middle;&#34;&#160;src=&#34;xxx.gif&#34;&#160;&#160;/&#62;用CSS实现图片和文字垂直居中对齐 &#160;&#160;
&#60;/div&#62;&#160;&#160;
&#60;br&#160;/&#62;&#60;br&#160;/&#62;&#160;&#160;
&#60;div&#62;&#160;&#160;
&#160;&#160;&#160;&#160;&#60;img&#160;src=&#34;xxx.gif&#34;&#160;&#160;/&#62;这个是没加样式的效果 &#160;&#160;
&#60;/div&#62;&#160;&#160;
&#60;br&#160;/&#62;&#60;br&#160;/&#62;&#160;&#160;
&#60;div&#62;&#160;&#160;
&#160;&#160;&#160;&#160;&#60;img&#160;align=absmiddle&#160;src=&#34;xxx.gif&#34;&#160;&#160;/&#62;这个是用align=absmiddle实现图片和文字垂直居中对齐 &#160;&#160;
&#60;/div&#62;&#160;&#160;


]]></description>
			<content:encoded><![CDATA[<p>想让图片和文字垂直居中对齐的话，可以在IMG标签下添加align=absmiddle属性即可实现，但align=absmiddle属性在W3C验证下通不过，但可以用CSS来代替IMG的align=absmiddle属性来实现垂直居中。<br />
	可以在CSS中加入vertical-align:middle;就能实现了</p>
<div class="dp-highlighter">
<div class="bar">
<div class="tools">Html代码 <a href="http://zgxzowen.javaeye.com/blog/555843#" onclick="dp.sh.Toolbar.CopyToClipboard(this);return false;" title="复制代码"><img alt="复制代码" src="http://zgxzowen.javaeye.com/images/icon_copy.gif" /></a></div>
</p></div>
<ol class="dp-xml">
<li><span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">div</span><span class="tag">&gt;</span></font></strong><span>&nbsp;&nbsp;</span></span></li>
<li><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">img</span></font></strong><span>&nbsp;</span><span class="attribute"><font color="#ff0000">style</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">&quot;vertical-align:middle;&quot;</font></span><span>&nbsp;</span><span class="attribute"><font color="#ff0000">src</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">&quot;xxx.gif&quot;</font></span><span>&nbsp;&nbsp;</span><span class="tag"><strong><font color="#006699">/&gt;</font></strong></span><span>用CSS实现图片和文字垂直居中对齐 &nbsp;&nbsp;</span></li>
<li><strong><font color="#006699"><span class="tag">&lt;/</span><span class="tag-name">div</span><span class="tag">&gt;</span></font></strong><span>&nbsp;&nbsp;</span></li>
<li><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">br</span></font></strong><span>&nbsp;</span><strong><font color="#006699"><span class="tag">/&gt;</span><span class="tag">&lt;</span><span class="tag-name">br</span></font></strong><span>&nbsp;</span><span class="tag"><strong><font color="#006699">/&gt;</font></strong></span><span>&nbsp;&nbsp;</span></li>
<li><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">div</span><span class="tag">&gt;</span></font></strong><span>&nbsp;&nbsp;</span></li>
<li><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">img</span></font></strong><span>&nbsp;</span><span class="attribute"><font color="#ff0000">src</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">&quot;xxx.gif&quot;</font></span><span>&nbsp;&nbsp;</span><span class="tag"><strong><font color="#006699">/&gt;</font></strong></span><span>这个是没加样式的效果 &nbsp;&nbsp;</span></li>
<li><strong><font color="#006699"><span class="tag">&lt;/</span><span class="tag-name">div</span><span class="tag">&gt;</span></font></strong><span>&nbsp;&nbsp;</span></li>
<li><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">br</span></font></strong><span>&nbsp;</span><strong><font color="#006699"><span class="tag">/&gt;</span><span class="tag">&lt;</span><span class="tag-name">br</span></font></strong><span>&nbsp;</span><span class="tag"><strong><font color="#006699">/&gt;</font></strong></span><span>&nbsp;&nbsp;</span></li>
<li><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">div</span><span class="tag">&gt;</span></font></strong><span>&nbsp;&nbsp;</span></li>
<li><span>&nbsp;&nbsp;&nbsp;&nbsp;</span><strong><font color="#006699"><span class="tag">&lt;</span><span class="tag-name">img</span></font></strong><span>&nbsp;</span><span class="attribute"><font color="#ff0000">align</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">absmiddle</font></span><span>&nbsp;</span><span class="attribute"><font color="#ff0000">src</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">&quot;xxx.gif&quot;</font></span><span>&nbsp;&nbsp;</span><span class="tag"><strong><font color="#006699">/&gt;</font></strong></span><span>这个是用</span><span class="attribute"><font color="#ff0000">align</font></span><span>=</span><span class="attribute-value"><font color="#0000ff">absmiddle</font></span><span>实现图片和文字垂直居中对齐 &nbsp;&nbsp;</span></li>
<li><strong><font color="#006699"><span class="tag">&lt;/</span><span class="tag-name">div</span><span class="tag">&gt;</span></font></strong><span>&nbsp;&nbsp;</span></li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=188</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>用AS3代码生成EA类图(转)</title>
		<link>http://www.riaelite.com/blog/?p=182</link>
		<comments>http://www.riaelite.com/blog/?p=182#comments</comments>
		<pubDate>Tue, 20 Apr 2010 11:10:55 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Others]]></category>
		<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=182</guid>
		<description><![CDATA[EA(Enterprise Architect)是支持多种流行语言脚本双向工程的UML建模工具。更难得的是，它还支持AS3，今天谈一谈怎样从AS3代码生成EA类图。
一、准备
下载安装EA：http://www.sparxsystems.com.au/products/ea_downloads.html。
二、操作步骤
点击此处查看动画演示。
三、说明

此处的AS3代码指的是AS3类文件，当然也支持AS2类文件；
本操作中的sample类图名是EA根据AS路径自动生成的；
还可以通过工具栏菜单Project&#62;Source Code Engeering&#62;Import Source Directory或Import ActionScript Files来导入AS代码。
如果修改了AS代码，不用再次导入，选择Project&#62;Source Code Engeering&#62;Synchronize Package Contents即可实现AS代码与EA类图的同步更新。

]]></description>
			<content:encoded><![CDATA[<p>EA(Enterprise Architect)是支持多种流行语言脚本双向工程的UML建模工具。更难得的是，它还支持AS3，今天谈一谈怎样从AS3代码生成EA类图。</p>
<p>一、准备</p>
<p>下载安装EA：<a href="http://www.sparxsystems.com.au/products/ea_downloads.html">http://www.sparxsystems.com.au/products/ea_downloads.html</a>。</p>
<p>二、操作步骤</p>
<p><a href="http://www.riafan.com/userfiles/flash/07-11/model.html">点击此处</a>查看动画演示。</p>
<p>三、说明</p>
<ol>
<li>此处的AS3代码指的是AS3类文件，当然也支持AS2类文件；</li>
<li>本操作中的sample类图名是EA根据AS路径自动生成的；</li>
<li>还可以通过工具栏菜单<span>Project</span>&gt;<span>Source Code Engeering</span>&gt;<span>Import Source Directory</span>或<span>Import ActionScript Files</span>来导入AS代码。</li>
<li>如果修改了AS代码，不用再次导入，选择<span>Project</span>&gt;<span>Source Code Engeering</span>&gt;<span>Synchronize Package Contents</span>即可实现AS代码与EA类图的同步更新。</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=182</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>翻转bitmapdata对象方法</title>
		<link>http://www.riaelite.com/blog/?p=180</link>
		<comments>http://www.riaelite.com/blog/?p=180#comments</comments>
		<pubDate>Mon, 12 Apr 2010 15:13:38 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Flash/As3]]></category>
		<category><![CDATA[翻转，bitmapdata、]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=180</guid>
		<description><![CDATA[//向右旋转90度
public function scaleRight(bmp:BitmapData):BitmapData{
var m:Matrix = new Matrix();
m.rotate(Math.PI/2);
m.translate(bmp.height,0);
var bd:BitmapData = new BitmapData(bmp.height, bmp.width,false);
bd.draw(bmp,m);
return bd;
}
//向左旋转90度
public function scaleLeft(bmp:BitmapData):BitmapData{
var m:Matrix = new Matrix();
m.rotate(-Math.PI/2);
m.translate(0,bmp.width);
var bd:BitmapData = new BitmapData(bmp.height, bmp.width,false);
bd.draw(bmp,m);
return bd;
}
]]></description>
			<content:encoded><![CDATA[<pre class="actionscript3" style="font-family: monospace;"><span style="color: rgb(0, 153, 0);">//向右旋转90度</span>
<span style="font-weight: bold; color: rgb(0, 51, 255);">public</span> <span style="font-weight: bold; color: rgb(51, 153, 102);">function</span> scaleRight<span style="color: rgb(0, 0, 0);">(</span>bmp<span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">BitmapData</span><span style="color: rgb(0, 0, 0);">)</span><span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">BitmapData</span><span style="color: rgb(0, 0, 0);">{</span>
<span style="font-weight: bold; color: rgb(102, 153, 204);">var</span> m<span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">Matrix</span> = <span style="font-weight: bold; color: rgb(0, 51, 255);">new</span> <span style="color: rgb(0, 73, 147);">Matrix</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">)</span>;
m.<span style="color: rgb(0, 73, 147);">rotate</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 73, 147);">Math</span>.<span style="color: rgb(0, 73, 147);">PI</span><span style="font-weight: bold; color: rgb(0, 0, 0);">/</span><span style="font-weight: bold; color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">)</span>;
m.<span style="color: rgb(0, 73, 147);">translate</span><span style="color: rgb(0, 0, 0);">(</span>bmp.<span style="color: rgb(0, 73, 147);">height</span>,<span style="font-weight: bold; color: rgb(0, 0, 0);">0</span><span style="color: rgb(0, 0, 0);">)</span>;
<span style="font-weight: bold; color: rgb(102, 153, 204);">var</span> bd<span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">BitmapData</span> = <span style="font-weight: bold; color: rgb(0, 51, 255);">new</span> <span style="color: rgb(0, 73, 147);">BitmapData</span><span style="color: rgb(0, 0, 0);">(</span>bmp.<span style="color: rgb(0, 73, 147);">height</span>, bmp.<span style="color: rgb(0, 73, 147);">width</span>,<span style="font-weight: bold; color: rgb(0, 51, 255);">false</span><span style="color: rgb(0, 0, 0);">)</span>;
bd.<span style="color: rgb(0, 73, 147);">draw</span><span style="color: rgb(0, 0, 0);">(</span>bmp,m<span style="color: rgb(0, 0, 0);">)</span>;
<span style="font-weight: bold; color: rgb(0, 51, 255);">return</span> bd;
<span style="color: rgb(0, 0, 0);">}</span>
<span style="color: rgb(0, 153, 0);">//向左旋转90度</span>
<span style="font-weight: bold; color: rgb(0, 51, 255);">public</span> <span style="font-weight: bold; color: rgb(51, 153, 102);">function</span> scaleLeft<span style="color: rgb(0, 0, 0);">(</span>bmp<span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">BitmapData</span><span style="color: rgb(0, 0, 0);">)</span><span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">BitmapData</span><span style="color: rgb(0, 0, 0);">{</span>
<span style="font-weight: bold; color: rgb(102, 153, 204);">var</span> m<span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">Matrix</span> = <span style="font-weight: bold; color: rgb(0, 51, 255);">new</span> <span style="color: rgb(0, 73, 147);">Matrix</span><span style="color: rgb(0, 0, 0);">(</span><span style="color: rgb(0, 0, 0);">)</span>;
m.<span style="color: rgb(0, 73, 147);">rotate</span><span style="color: rgb(0, 0, 0);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">-</span><span style="color: rgb(0, 73, 147);">Math</span>.<span style="color: rgb(0, 73, 147);">PI</span><span style="font-weight: bold; color: rgb(0, 0, 0);">/</span><span style="font-weight: bold; color: rgb(0, 0, 0);">2</span><span style="color: rgb(0, 0, 0);">)</span>;
m.<span style="color: rgb(0, 73, 147);">translate</span><span style="color: rgb(0, 0, 0);">(</span><span style="font-weight: bold; color: rgb(0, 0, 0);">0</span>,bmp.<span style="color: rgb(0, 73, 147);">width</span><span style="color: rgb(0, 0, 0);">)</span>;
<span style="font-weight: bold; color: rgb(102, 153, 204);">var</span> bd<span style="font-weight: bold; color: rgb(0, 0, 0);">:</span><span style="color: rgb(0, 73, 147);">BitmapData</span> = <span style="font-weight: bold; color: rgb(0, 51, 255);">new</span> <span style="color: rgb(0, 73, 147);">BitmapData</span><span style="color: rgb(0, 0, 0);">(</span>bmp.<span style="color: rgb(0, 73, 147);">height</span>, bmp.<span style="color: rgb(0, 73, 147);">width</span>,<span style="font-weight: bold; color: rgb(0, 51, 255);">false</span><span style="color: rgb(0, 0, 0);">)</span>;
bd.<span style="color: rgb(0, 73, 147);">draw</span><span style="color: rgb(0, 0, 0);">(</span>bmp,m<span style="color: rgb(0, 0, 0);">)</span>;
<span style="font-weight: bold; color: rgb(0, 51, 255);">return</span> bd;
<span style="color: rgb(0, 0, 0);">}</span></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=180</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3组件之UIScrollBar滚动条</title>
		<link>http://www.riaelite.com/blog/?p=175</link>
		<comments>http://www.riaelite.com/blog/?p=175#comments</comments>
		<pubDate>Thu, 08 Apr 2010 22:39:43 +0000</pubDate>
		<dc:creator>韶东</dc:creator>
				<category><![CDATA[Flash/As3]]></category>
		<category><![CDATA[UIScrollBar]]></category>

		<guid isPermaLink="false">http://www.riaelite.com/blog/?p=175</guid>
		<description><![CDATA[
?View Code ACTIONSCRIPT1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import fl.controls.UIScrollBar;
import fl.controls.SliderDirection;//滑动条的方向
&#160;
var outText:URLRequest=new URLRequest&#40;&#38;quot;UIScrollBarText.txt&#38;quot;&#41;;
var inText:URLLoader=new URLLoader&#40;&#41;;
inText.load&#40;outText&#41;;
inText.addEventListener&#40;Event.COMPLETE,completeFun&#41;;
function completeFun&#40;e:Event&#41; &#123;
	var bl:URLVariables=new URLVariables&#40;inText.data&#41;;
	text1.text=bl.a2;//部分载入
	//text1.text=inText.data;//载入全部文本
&#125;
&#160;
var newUIScrollBar:UIScrollBar=new UIScrollBar&#40;&#41;;
addChild&#40;newUIScrollBar&#41;;
with &#40;newUIScrollBar&#41; &#123;
	x=text1.x+text1.width;
	y=text1.y;
	height=text1.height;
	direction=SliderDirection.VERTICAL;
	scrollTarget=text1;
&#125;

]]></description>
			<content:encoded><![CDATA[
<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('p175code2'); return false;">View Code</a> ACTIONSCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p1752"><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="p175code2"><pre class="actionscript" style="font-family:monospace;"><span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">controls</span>.<span style="color: #006600;">UIScrollBar</span>;
<span style="color: #0066CC;">import</span> fl.<span style="color: #006600;">controls</span>.<span style="color: #006600;">SliderDirection</span>;<span style="color: #808080; font-style: italic;">//滑动条的方向</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> outText:URLRequest=<span style="color: #000000; font-weight: bold;">new</span> URLRequest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&amp;</span>quot;UIScrollBarText.<span style="color: #006600;">txt</span><span style="color: #66cc66;">&amp;</span>quot;<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">var</span> inText:URLLoader=<span style="color: #000000; font-weight: bold;">new</span> URLLoader<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
inText.<span style="color: #0066CC;">load</span><span style="color: #66cc66;">&#40;</span>outText<span style="color: #66cc66;">&#41;</span>;
inText.<span style="color: #006600;">addEventListener</span><span style="color: #66cc66;">&#40;</span>Event.<span style="color: #006600;">COMPLETE</span>,completeFun<span style="color: #66cc66;">&#41;</span>;
<span style="color: #000000; font-weight: bold;">function</span> completeFun<span style="color: #66cc66;">&#40;</span><span style="color: #0066CC;">e</span>:Event<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">var</span> bl:URLVariables=<span style="color: #000000; font-weight: bold;">new</span> URLVariables<span style="color: #66cc66;">&#40;</span>inText.<span style="color: #0066CC;">data</span><span style="color: #66cc66;">&#41;</span>;
	text1.<span style="color: #0066CC;">text</span>=bl.<span style="color: #006600;">a2</span>;<span style="color: #808080; font-style: italic;">//部分载入</span>
	<span style="color: #808080; font-style: italic;">//text1.text=inText.data;//载入全部文本</span>
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">var</span> newUIScrollBar:UIScrollBar=<span style="color: #000000; font-weight: bold;">new</span> UIScrollBar<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span>;
addChild<span style="color: #66cc66;">&#40;</span>newUIScrollBar<span style="color: #66cc66;">&#41;</span>;
<span style="color: #0066CC;">with</span> <span style="color: #66cc66;">&#40;</span>newUIScrollBar<span style="color: #66cc66;">&#41;</span> <span style="color: #66cc66;">&#123;</span>
	x=text1.<span style="color: #006600;">x</span>+text1.<span style="color: #0066CC;">width</span>;
	y=text1.<span style="color: #006600;">y</span>;
	<span style="color: #0066CC;">height</span>=text1.<span style="color: #0066CC;">height</span>;
	direction=SliderDirection.<span style="color: #006600;">VERTICAL</span>;
	scrollTarget=text1;
<span style="color: #66cc66;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.riaelite.com/blog/?feed=rss2&amp;p=175</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
