<?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>DFdou&#039;s Blog &#187; Load</title>
	<atom:link href="http://nwhy.org/tag/load/feed" rel="self" type="application/rss+xml" />
	<link>http://nwhy.org</link>
	<description>Life is short,Be yourself.</description>
	<lastBuildDate>Wed, 25 Aug 2010 05:26:10 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Flash-AS2和AS3的加载</title>
		<link>http://nwhy.org/flash-load.html</link>
		<comments>http://nwhy.org/flash-load.html#comments</comments>
		<pubDate>Mon, 23 Feb 2009 04:50:34 +0000</pubDate>
		<dc:creator>DFdou</dc:creator>
				<category><![CDATA[AIR+FB+AS3]]></category>
		<category><![CDATA[Flash AS2]]></category>
		<category><![CDATA[AS2]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Load]]></category>

		<guid isPermaLink="false">http://nwhy.org/?p=3804</guid>
		<description><![CDATA[在AS2里，加载图片和swf，使用loadMovie/loadMovieNum或者loadClip方法即可，如： function initList (_mc:MovieClip, numStart:Number, numEnd:Number) { for (var i:Number = numStart; i &#60; numEnd; i++) { _mc.createEmptyMovieClip (&#34;e_ava... ]]></description>
			<content:encoded><![CDATA[<p>在AS2里，加载图片和swf，使用loadMovie/loadMovieNum或者loadClip方法即可，如：</p>
<pre class="brush: js">
function initList (_mc:MovieClip, numStart:Number, numEnd:Number) {
	for (var i:Number = numStart; i &lt; numEnd; i++) {
		_mc.createEmptyMovieClip (&quot;e_avatar&quot; + i, 1000 + (numEnd - i));
		_mc[&quot;e_avatar&quot; + i].createEmptyMovieClip (&quot;loader&quot;, 1000 + i);
                _mc[&quot;e_avatar&quot; + i].loader.loadMovie(i+&quot;.jpg&quot;);
                _mc[&quot;e_avatar&quot; + i]._x=Math.random()*stageW;//随机摆放
                _mc[&quot;e_avatar&quot; + i]._y=Math.random()*stageH;
	}
}
</pre>
<p>相对AS2而言，AS3更加规范，加载方法统一成了load方法，例子如下：</p>
<pre class="brush: js">
function initList (_evt:Event):void {
	var userXML = XML(userLoader.data);
	var userNum=userXML.children().length();
	for (var i:uint=0; i&lt;userNum; i++) {
		var e_avatarLdr:Loader = new Loader();//建立loader对象
		var e_avatarURL:String = userXML.item[i].avatar;//载入文件名称
		var e_avatarURLReq:URLRequest = new URLRequest(e_avatarURL);//建立载入接收对象
		e_avatarLdr.load (e_avatarURLReq);//使用load方法加载e_avatarURLReq
		e_avatarLdr.contentLoaderInfo.addEventListener (Event.COMPLETE, e_avatarLoaded);//载入完成后响应
		function e_avatarLoaded (_evt:Event):void {
			userAvatar.addChild (_evt.target.content);//把载入的对象加入容器
			_evt.target.content.x=Math.random()*stageW;//随机摆放
			_evt.target.content.y=Math.random()*stageH;
		}
	}
}
</pre>
<p>从例子中我们可以发现，AS2和AS3的加载机制几乎完全不同，具体内容可以参阅Flash CS3自带的帮助文档哈。</p>
<h4  class="related_post_title">Some Related Posts</h4><ul class="related_post"><li>2009/06/24 -- <a  href="http://nwhy.org/flash-ship-on-android-phone.html" title="Flash-Adobe&#8217;s Flash to ship on new Android phone">Flash-Adobe&#8217;s Flash to ship on new Android phone</a> (0)</li><li>2009/06/18 -- <a  href="http://nwhy.org/flash-swfinputs-solving-mozilla-transparent-mode.html" title="Flash-Transparent时在FF和Safari下无法输入中文的解决方案">Flash-Transparent时在FF和Safari下无法输入中文的解决方案</a> (0)</li><li>2009/05/28 -- <a  href="http://nwhy.org/aas3wdp-chapter-8-composite-2.html" title="AAS3WDP-Chapter 8 Composite 组合模式(下)">AAS3WDP-Chapter 8 Composite 组合模式(下)</a> (0)</li><li>2009/05/27 -- <a  href="http://nwhy.org/aas3wdp-chapter-8-composite-1.html" title="AAS3WDP-Chapter 8 Composite 组合模式(上)">AAS3WDP-Chapter 8 Composite 组合模式(上)</a> (0)</li><li>2009/05/22 -- <a  href="http://nwhy.org/about-flash.html" title="About Flash">About Flash</a> (1)</li><li>2009/05/19 -- <a  href="http://nwhy.org/aas3wdp-chapter-7-iterator.html" title="AAS3WDP-Chapter 7 Iterator 迭代模式">AAS3WDP-Chapter 7 Iterator 迭代模式</a> (0)</li><li>2009/05/15 -- <a  href="http://nwhy.org/aas3wdp-chapter-6-remote-proxy.html" title="AAS3WDP-Chapter 6 Remote Proxy 远程代理">AAS3WDP-Chapter 6 Remote Proxy 远程代理</a> (0)</li><li>2009/05/14 -- <a  href="http://nwhy.org/aas3wdp-virtual-proxy.html" title="AAS3WDP-Chapter 6 Virtual Proxy 虚拟代理模式">AAS3WDP-Chapter 6 Virtual Proxy 虚拟代理模式</a> (0)</li><li>2009/05/13 -- <a  href="http://nwhy.org/aas3wdp-chapter-5-factory-%e5%b7%a5%e5%8e%82%e6%a8%a1%e5%bc%8f.html" title="AAS3WDP-Chapter 5 Factory 工厂模式">AAS3WDP-Chapter 5 Factory 工厂模式</a> (0)</li><li>2009/02/11 -- <a  href="http://nwhy.org/flash-bubble-2.html" title="Flash-Bubble冒泡机制">Flash-Bubble冒泡机制</a> (1)</li></ul>]]></content:encoded>
			<wfw:commentRss>http://nwhy.org/flash-load.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
