<?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>Creative Lab</title>
	<atom:link href="http://www.minicg.com/blog/feed" rel="self" type="application/rss+xml" />
	<link>http://www.minicg.com/blog</link>
	<description>A TECHNOLOGY BLOG FOR ALL PROGRAMMER &#38; DESIGNER</description>
	<lastBuildDate>Fri, 05 Mar 2010 03:26:32 +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>Adobe将在4月发布CS5？</title>
		<link>http://www.minicg.com/blog/archives/post_196.html</link>
		<comments>http://www.minicg.com/blog/archives/post_196.html#comments</comments>
		<pubDate>Fri, 05 Mar 2010 03:21:48 +0000</pubDate>
		<dc:creator>WaveF</dc:creator>
				<category><![CDATA[相关资讯]]></category>
		<category><![CDATA[CS5]]></category>
		<category><![CDATA[Release]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/?p=196</guid>
		<description><![CDATA[最近从 CS5.org 了解到 Adobe 可能会在4月21-22日的会议上发表一个新产品，而这个产品也很有可能就是传说中的 Creative Suite 5。
我们知道Adobe为了加速CS5的发布时间，连Beta版都取消了，希望这个CS5版本能一洗CS4的颓气，毕竟CS4的bug、崩溃、耗资源这些特点不是常人所能接受的。特别是在 HTML5 准备迎头痛击 Flash 的时候，Adobe 不应该再拿这种半成品IDE来忽悠用户了。CS4为用户带来了设计软件史上最糟糕的体验，我们期待着新一代的 Creative Suite 能够改变这一现状。
以下是消息原文链接：

Adobe CS5 release date – Aprill 21-22 ?
Piper Jaffray: Adobe CS5 will ship in April 2010

　
]]></description>
			<content:encoded><![CDATA[<p>最近从 <a href="http://CS5.org" target="_blank">CS5.org</a> 了解到 Adobe 可能会在4月21-22日的会议上发表一个新产品，而这个产品也很有可能就是传说中的 Creative Suite 5。</p>
<p>我们知道Adobe为了加速CS5的发布时间，连Beta版都取消了，希望这个CS5版本能一洗CS4的颓气，毕竟CS4的bug、崩溃、耗资源这些特点不是常人所能接受的。特别是在 HTML5 准备迎头痛击 Flash 的时候，Adobe 不应该再拿这种半成品IDE来忽悠用户了。CS4为用户带来了设计软件史上最糟糕的体验，我们期待着新一代的 Creative Suite 能够改变这一现状。</p>
<p>以下是消息原文链接：</p>
<ul>
<li><a href="http://cs5.org/?p=518" target="_blank">Adobe CS5 release date – Aprill 21-22 ?</a></li>
<li><a href="http://cs5.org/?p=136" target="_blank">Piper Jaffray: Adobe CS5 will ship in April 2010</a></li>
</ul>
<p>　</p>
]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_196.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>发现一个好的学习正则的工具</title>
		<link>http://www.minicg.com/blog/archives/post_189.html</link>
		<comments>http://www.minicg.com/blog/archives/post_189.html#comments</comments>
		<pubDate>Wed, 27 Jan 2010 14:14:18 +0000</pubDate>
		<dc:creator>Libins</dc:creator>
				<category><![CDATA[技术文档]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/archives/post_189.html</guid>
		<description><![CDATA[http://gskinner.com/RegExr
]]></description>
			<content:encoded><![CDATA[<p><a href="http://gskinner.com/RegExr">http://gskinner.com/RegExr</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_189.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>图片粒子运动效果</title>
		<link>http://www.minicg.com/blog/archives/post_158.html</link>
		<comments>http://www.minicg.com/blog/archives/post_158.html#comments</comments>
		<pubDate>Mon, 11 Jan 2010 07:22:44 +0000</pubDate>
		<dc:creator>Libins</dc:creator>
				<category><![CDATA[技术文档]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[粒子]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/?p=158</guid>
		<description><![CDATA[这个效果是比较常见的，网络上很多地方都用到过，最近同事需要这个效果，我就把它弄成了一个类文件来实现
因为使用到了TweenLite这个运动引擎，所以大家需要移步到这里先：http://www.greensock.com/tweenlite/
在网页右上角选择你需要的版本，这里我使用的是AS3.0的



package cn.libins.bitmap
&#123;
    import flash.display.Bitmap;
    import flash.display.BitmapData;
    import flash.display.DisplayObject;
    import flash.display.DisplayObjectContainer;
    import flash.display.MovieClip;
    import flash.display.Sprite;
    import flash.display.Stage;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.ColorTransform;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import __AS3__.vec.Vector;
    import gs.TweenLite;
    import fl.transitions.easing.*;
    import flash.utils.setTimeout;
    import flash.utils.clearTimeout;
    import flash.ui.Mouse;
&#160;
    /*
     * v02,修改错误运动BUG，添加关闭鼠标事件
     * @author libins
     */
    public class BitmapCuts extends Sprite
    &#123;
        private var _oldBitmap:Bitmap;                  //对象的原始位图信息
        private var _wNum     :uint;                    //X坐标轴上的个数
        private var _hNum     :uint;           [...]]]></description>
			<content:encoded><![CDATA[<p>这个效果是比较常见的，网络上很多地方都用到过，最近同事需要这个效果，我就把它弄成了一个类文件来实现</p>
<p>因为使用到了TweenLite这个运动引擎，所以大家需要移步到这里先：<a href="http://www.greensock.com/tweenlite/" target="_blank">http://www.greensock.com/tweenlite/</a><br />
在网页右上角选择你需要的版本，这里我使用的是AS3.0的</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/particle_preview.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-175" title="图片粒子运动效果预览" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/particle_preview.jpg" alt="" width="300" height="300" /></a></p>
<p><span id="more-158"></span></p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #9900cc; font-weight: bold;">package</span> cn.libins.bitmap
<span style="color: #000000;">&#123;</span>
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Bitmap</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">BitmapData</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">DisplayObject</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">DisplayObjectContainer</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">MovieClip</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Stage</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">MouseEvent</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">ColorTransform</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">Point</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">Rectangle</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> __AS3__.vec.Vector;
    <span style="color: #0033ff; font-weight: bold;">import</span> gs.TweenLite;
    <span style="color: #0033ff; font-weight: bold;">import</span> fl.transitions.easing.<span style="color: #000000; font-weight: bold;">*</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span>.<span style="color: #004993;">setTimeout</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.utils</span>.<span style="color: #004993;">clearTimeout</span>;
    <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.ui</span>.<span style="color: #004993;">Mouse</span>;
&nbsp;
    <span style="color: #3f5fbf;">/*
     * v02,修改错误运动BUG，添加关闭鼠标事件
     * @author libins
     */</span>
    <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> BitmapCuts extends <span style="color: #004993;">Sprite</span>
    <span style="color: #000000;">&#123;</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _oldBitmap<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Bitmap</span>;                  <span style="color: #009900;">//对象的原始位图信息</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _wNum     <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;                    <span style="color: #009900;">//X坐标轴上的个数</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _hNum     <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;                    <span style="color: #009900;">//Y坐标轴上的个数</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _debug    <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">false</span>;         <span style="color: #009900;">//这个是调试代码用的，可以无视</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _sprites  <span style="color: #000000; font-weight: bold;">:</span>Vector.<span style="color: #000000; font-weight: bold;">&lt;</span>MovieClip<span style="color: #000000; font-weight: bold;">&gt;</span>;      <span style="color: #009900;">//装载单个切割后的容器</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _stage    <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Stage</span>;                   <span style="color: #009900;">//舞台对象</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _disNum   <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;                    <span style="color: #009900;">//位图像素切割后的间距</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _initX    <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;                  <span style="color: #009900;">//初始X坐标</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _initY    <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;                  <span style="color: #009900;">//初始Y坐标</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _delayInt <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;                  <span style="color: #009900;">//延时的对象</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _disX     <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;                  <span style="color: #009900;">//运动的X值</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _disY     <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;                  <span style="color: #009900;">//运动的Y值</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _disZ     <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;                  <span style="color: #009900;">//运动的Z值</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _disA     <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;                  <span style="color: #009900;">//运动的Alpha值</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _currNum  <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;                    <span style="color: #009900;">//当前运动的索引值</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _total    <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;                    <span style="color: #009900;">//运动的总值</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _spContain<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span>;                  <span style="color: #009900;">//所有窃钩后的小图的父级容器</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _closeIcon<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span>;               <span style="color: #009900;">//关闭按钮对象</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _moveType <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;                  <span style="color: #009900;">//运动的类型</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _delayArr <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span>;                   <span style="color: #009900;">//延时的数组，保存所有的延时对象</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _moveTime <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;                    <span style="color: #009900;">//运动的时间</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _easeType <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Function</span>;                <span style="color: #009900;">//缓冲的类型</span>
        <span style="color: #3f5fbf;">/*
         * Param1 需要运动的对象
         * Param2 横坐标个数
         * Param3 纵坐标个数
         * Param4 小框之间距离
         * Param5 偏移的X坐标
         * Param6 偏移的Y坐标
         * Param7 偏移的Z坐标
         * Param8 偏移的alpha坐标
         */</span>
        <span style="color: #009900;">//构造函数，就是外界传递的一些初始化的信息，主要与切割，运动参数有关</span>
        <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> BitmapCuts<span style="color: #000000;">&#40;</span>$target<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span>, $wNum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">5</span>, $hNum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">5</span>, $disNum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">5</span>, $disX<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">100</span>,$disY<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">100</span>,$disZ<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">100</span>,$disA<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">0.5</span>,$moveTime<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>  =<span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>$target <span style="color: #0033ff; font-weight: bold;">is</span> <span style="color: #004993;">Bitmap</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                 _oldBitmap = $target <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">Bitmap</span>;
             <span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
                 _oldBitmap = getBitmap<span style="color: #000000;">&#40;</span>$target<span style="color: #000000;">&#41;</span>;
             <span style="color: #000000;">&#125;</span>
             _wNum    = $wNum;
             _hNum    = $hNum;
             _disNum  = $disNum;
             _sprites =  <span style="color: #0033ff; font-weight: bold;">new</span> Vector.<span style="color: #000000; font-weight: bold;">&lt;</span>MovieClip<span style="color: #000000; font-weight: bold;">&gt;</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
              _initX   = $target.<span style="color: #004993;">x</span>;
             _initY   = $target.<span style="color: #004993;">y</span>;
             _disX    = $disX;
             _disY    = $disY;
             _disZ    = $disZ;
             _disA    = $disA;
             _moveTime = $moveTime;
             _total   = $wNum <span style="color: #000000; font-weight: bold;">*</span> $hNum;
             $target.<span style="color: #004993;">visible</span> = <span style="color: #0033ff; font-weight: bold;">false</span>;
             <span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ADDED_TO_STAGE</span>, addToStage<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//添加到舞台，初始化一些基本的参数</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> addToStage<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ADDED_TO_STAGE</span>, addToStage<span style="color: #000000;">&#41;</span>;
             _stage     = <span style="color: #004993;">stage</span>;
             _spContain = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
             _delayArr  = <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>;
             startCuts<span style="color: #000000;">&#40;</span>_wNum, _hNum, _disNum<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//切割对象的函数，par1是宽度上的个数，par2是高度上的，par3是间距</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> startCuts<span style="color: #000000;">&#40;</span>$wNum<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>, $hNum, $disNum<span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>  = _oldBitmap.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">/</span> $wNum;                      <span style="color: #009900;">//根据切割的个数，计算切割的宽度</span>
             <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">height</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>  = _oldBitmap.<span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">/</span> $hNum;                     <span style="color: #009900;">//同理</span>
             <span style="color: #6699cc; font-weight: bold;">var</span> i     <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>    = <span style="color: #000000; font-weight:bold;">0</span>;
             <span style="color: #0033ff; font-weight: bold;">while</span> <span style="color: #000000;">&#40;</span>i<span style="color: #000000; font-weight: bold;">&lt;</span>$wNum<span style="color: #000000;">&#41;</span>
             <span style="color: #000000;">&#123;</span>
                 <span style="color: #6699cc; font-weight: bold;">var</span> j<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>     = <span style="color: #000000; font-weight:bold;">0</span>;
                 <span style="color: #0033ff; font-weight: bold;">while</span> <span style="color: #000000;">&#40;</span>j<span style="color: #000000; font-weight: bold;">&lt;</span>$hNum<span style="color: #000000;">&#41;</span>
                 <span style="color: #000000;">&#123;</span>
                     <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">bitmapData</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span>, <span style="color: #004993;">height</span>,<span style="color: #0033ff; font-weight: bold;">true</span>,0xff334455<span style="color: #000000;">&#41;</span>;
                     <span style="color: #004993;">bitmapData</span>.<span style="color: #004993;">copyPixels</span><span style="color: #000000;">&#40;</span>_oldBitmap.<span style="color: #004993;">bitmapData</span>, <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#40;</span>i <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #004993;">width</span>, j <span style="color: #000000; font-weight: bold;">*</span> <span style="color: #004993;">height</span>, <span style="color: #004993;">width</span>, <span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span>,<span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;     <span style="color: #009900;">//从原始位图上获取像素信息</span>
                     <span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span>          =  makeSprite<span style="color: #000000;">&#40;</span><span style="color: #004993;">bitmapData</span>, <span style="color: #004993;">width</span>, <span style="color: #004993;">height</span><span style="color: #000000;">&#41;</span>;
                     mc.<span style="color: #004993;">x</span>                      = _initX <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000;">&#40;</span><span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">+</span> _disNum<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> i;
                     mc.<span style="color: #004993;">y</span>                      = _initY <span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">height</span> <span style="color: #000000; font-weight: bold;">+</span> _disNum<span style="color: #000000;">&#41;</span> <span style="color: #000000; font-weight: bold;">*</span> j;
                     mc.<span style="color: #004993;">name</span>                   = i <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;_&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> j;
                     mc.i                      = i;
                     mc.j                      = j;
                     mc.moveed                 = <span style="color: #0033ff; font-weight: bold;">false</span>;
                     mc.orgX                   = mc.<span style="color: #004993;">x</span>;
                     mc.orgY                   = mc.<span style="color: #004993;">y</span>;
                     mc.orgZ                   = mc.z;
                     mc.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, spClick<span style="color: #000000;">&#41;</span>;
                     _spContain.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>mc<span style="color: #000000;">&#41;</span>;
                     j<span style="color: #000000; font-weight: bold;">++</span>;
                     _sprites.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>mc<span style="color: #000000;">&#41;</span>;
                 <span style="color: #000000;">&#125;</span>
                 i<span style="color: #000000; font-weight: bold;">++</span>;
             <span style="color: #000000;">&#125;</span>
             <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_spContain<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//制作单个装有位图信息的MovieClip</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> makeSprite<span style="color: #000000;">&#40;</span>$bitmapData<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span>,$width<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>,$height<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> mc <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
             mc.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
             mc.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">beginBitmapFill</span><span style="color: #000000;">&#40;</span>$bitmapData<span style="color: #000000;">&#41;</span>;
             mc.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span>, $width, $height<span style="color: #000000;">&#41;</span>;
             mc.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
             <span style="color: #0033ff; font-weight: bold;">return</span>  mc;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//这个是将我们需要操作的原始对象，转为位图数据</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getBitmap<span style="color: #000000;">&#40;</span>$target<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Bitmap</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">bitmapData</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span>$target.<span style="color: #004993;">width</span>, $target.<span style="color: #004993;">height</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
             <span style="color: #004993;">bitmapData</span>.<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>$target<span style="color: #000000;">&#41;</span>;
             <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Bitmap</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">bitmapData</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//鼠标事件，根据点击的次数，判断数运动的类型</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> spClick<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = event.<span style="color: #004993;">currentTarget</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">MovieClip</span>;
            _moveType    = <span style="color: #000000;">&#40;</span>_moveType == <span style="color: #990000;">&quot;out&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">?</span><span style="color: #990000;">&quot;in&quot;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #990000;">&quot;out&quot;</span>;
            setMoveEabled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            removeDelay<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
            moveSP<span style="color: #000000;">&#40;</span>mc.i, mc.j<span style="color: #000000;">&#41;</span>;
            <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">mouseChildren</span> = <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">mouseEnabled</span> = <span style="color: #0033ff; font-weight: bold;">false</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//运动单个的位图</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> moveSP<span style="color: #000000;">&#40;</span>$i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>, $j<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> mc<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MovieClip</span> = _spContain.<span style="color: #004993;">getChildByName</span><span style="color: #000000;">&#40;</span>$i <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #990000;">&quot;_&quot;</span> <span style="color: #000000; font-weight: bold;">+</span> $j<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">MovieClip</span>;
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>mc.moveed<span style="color: #000000;">&#41;</span> <span style="color: #0033ff; font-weight: bold;">return</span>;                                  <span style="color: #009900;">// 这个地方比较关键，如果它当前正在移动的话，我们就必须关闭后面的代码，具体要结合checkPoint函数来分析</span>
             mc.moveed   = <span style="color: #0033ff; font-weight: bold;">true</span>;
             _delayInt   = <span style="color: #004993;">setTimeout</span><span style="color: #000000;">&#40;</span>checkPoint, <span style="color: #000000; font-weight:bold;">50</span>, $i, $j<span style="color: #000000;">&#41;</span>;       <span style="color: #009900;">//这个就是一个延时的函数，让对象依次运动</span>
             _delayArr.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>_delayInt<span style="color: #000000;">&#41;</span>;                              <span style="color: #009900;">//所有的延时对象装在数组里，方便删除，释放内存，避免出错，提高运行效率</span>
            <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>_moveType==<span style="color: #990000;">&quot;out&quot;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#123;</span>                                    <span style="color: #009900;">//放大的运动参数定义</span>
               mc.endX     = mc.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">+</span>_disX;
               mc.endY     = mc.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">+</span>_disY;
               mc.endZ     = mc.z <span style="color: #000000; font-weight: bold;">+</span>_disZ;
               mc.endA     = _disA;
               _easeType   = Elastic.easeOut;
            <span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>                                                  <span style="color: #009900;">//恢复的参数</span>
               mc.endX     = mc.orgX;
               mc.endY     = mc.orgY;
               mc.endZ     = mc.orgZ;
               mc.endA     = <span style="color: #000000; font-weight:bold;">1</span>;
               _easeType   = Elastic.easeInOut;
            <span style="color: #000000;">&#125;</span>
             <span style="color: #009900;">//TweenLite这个我就不用多说了</span>
             TweenLite.to<span style="color: #000000;">&#40;</span>mc, _moveTime, <span style="color: #000000;">&#123;</span> <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">:</span>mc.endX, z<span style="color: #000000; font-weight: bold;">:</span>mc.endZ, <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">:</span>mc.endY, <span style="color: #004993;">alpha</span><span style="color: #000000; font-weight: bold;">:</span>mc.endA, ease<span style="color: #000000; font-weight: bold;">:</span>_easeType,onComplete<span style="color: #000000; font-weight: bold;">:</span>removeInterval <span style="color: #000000;">&#125;</span> <span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//清空所有的延时对象</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> removeDelay<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #6699cc; font-weight: bold;">var</span> num<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = _delayArr.<span style="color: #004993;">length</span>;
            <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> num; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
            <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">clearTimeout</span><span style="color: #000000;">&#40;</span>_delayArr<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span><span style="color: #000000;">&#41;</span>;
                _delayArr<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span> = <span style="color: #0033ff; font-weight: bold;">null</span>;
            <span style="color: #000000;">&#125;</span>
            _delayArr = <span style="color: #000000;">&#91;</span><span style="color: #000000;">&#93;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//这个是移动对象的依次运动完毕后的函数，主要用于所有动作结束后，我们需要执行的效果                           </span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> removeInterval<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            _currNum  <span style="color: #000000; font-weight: bold;">++</span>;
            <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_currNum == _total<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                 <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_moveType == <span style="color: #990000;">&quot;out&quot;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                     <span style="color: #009900;">//如果是放大的运动类型，我们需要添加一个返回的标识</span>
                     showCloseIcon<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                 <span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
                     <span style="color: #009900;">//恢复类型的话，就删除上述的标识</span>
                     hideIcon<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                 <span style="color: #000000;">&#125;</span>
                 <span style="color: #009900;">//开启鼠标事件，一个运动结束后，才开启，避免反复点击图片出现的错误【这里偶主要是怕麻烦，所以一刀切了，之前也有一个方法，但是运行多次，吃内存～】</span>
                 <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">mouseChildren</span> = <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">mouseEnabled</span> = <span style="color: #0033ff; font-weight: bold;">true</span>;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//运动开始前，必须允许他们可以执行，主要操作的属性对象为 moveed</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> setMoveEabled<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #6699cc; font-weight: bold;">var</span> num<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = _sprites.<span style="color: #004993;">length</span>;
              _currNum    = <span style="color: #000000; font-weight:bold;">0</span>;
             <span style="color: #0033ff; font-weight: bold;">for</span> <span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">int</span> = <span style="color: #000000; font-weight:bold;">0</span>; i <span style="color: #000000; font-weight: bold;">&lt;</span> num; i<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span>
             <span style="color: #000000;">&#123;</span>
                 _sprites<span style="color: #000000;">&#91;</span>i<span style="color: #000000;">&#93;</span>.moveed = <span style="color: #0033ff; font-weight: bold;">false</span>;
             <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//这个是比较关键的代码，功能在于，是多个对象以中心点散射执行，我们只需记录一个执行点，然后依次对他执行4个方向对象的运动，注意操作的范围</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> checkPoint<span style="color: #000000;">&#40;</span>$i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>, $j<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #009900;">//left</span>
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>$i <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> moveSP<span style="color: #000000;">&#40;</span>$i <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span>, $j<span style="color: #000000;">&#41;</span>;
             <span style="color: #009900;">//up</span>
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>$j <span style="color: #000000; font-weight: bold;">&gt;</span> <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> moveSP<span style="color: #000000;">&#40;</span>$i, $j <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>;
             <span style="color: #009900;">//right</span>
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>$i <span style="color: #000000; font-weight: bold;">&lt;</span> _wNum <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span> moveSP<span style="color: #000000;">&#40;</span>$i <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span>, $j<span style="color: #000000;">&#41;</span>;
             <span style="color: #009900;">//down</span>
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>$j <span style="color: #000000; font-weight: bold;">&lt;</span> _hNum <span style="color: #000000; font-weight: bold;">-</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>  moveSP<span style="color: #000000;">&#40;</span>$i , $j <span style="color: #000000; font-weight: bold;">+</span> <span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//添加关闭标识</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> showCloseIcon<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #004993;">stage</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_MOVE</span>, checkHit<span style="color: #000000;">&#41;</span>;
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//判断鼠标是否在我们的对象上</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> checkHit<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_spContain.<span style="color: #004993;">hitTestPoint</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">stage</span>.<span style="color: #004993;">mouseX</span>, <span style="color: #004993;">stage</span>.<span style="color: #004993;">mouseY</span>, <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                 showIcon<span style="color: #000000;">&#40;</span>event<span style="color: #000000;">&#41;</span>;    
             <span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
                 hideIcon<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;    
             <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//具体添加标识的代码，如果已存在，就让它实现鼠标追随效果</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> showIcon<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
             <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight: bold;">!</span>_closeIcon<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                 <span style="color: #004993;">Mouse</span>.<span style="color: #004993;">hide</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                 _closeIcon = <span style="color: #0033ff; font-weight: bold;">new</span> CloseIcon<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                 _closeIcon.<span style="color: #004993;">mouseChildren</span> = _closeIcon.<span style="color: #004993;">mouseEnabled</span> = <span style="color: #0033ff; font-weight: bold;">false</span>;
                 <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_closeIcon<span style="color: #000000;">&#41;</span>;
             <span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
                 _closeIcon.<span style="color: #004993;">x</span> = <span style="color: #004993;">stage</span>.<span style="color: #004993;">mouseX</span>;
                 _closeIcon.<span style="color: #004993;">y</span> = <span style="color: #004993;">stage</span>.<span style="color: #004993;">mouseY</span>;
                 <span style="color: #009900;">//这个是让鼠标追随效果真实些,事件执行后,强制让舞台渲染一次舞台对象</span>
                 event.<span style="color: #004993;">updateAfterEvent</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
             <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
        <span style="color: #009900;">//删除标识</span>
        <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> hideIcon<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
            <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_closeIcon<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
                <span style="color: #004993;">removeChild</span><span style="color: #000000;">&#40;</span>_closeIcon<span style="color: #000000;">&#41;</span>;
                 _closeIcon = <span style="color: #0033ff; font-weight: bold;">null</span>;
                 <span style="color: #004993;">Mouse</span>.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
                 <span style="color: #004993;">stage</span>.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_MOVE</span>, checkHit<span style="color: #000000;">&#41;</span>;
            <span style="color: #000000;">&#125;</span>
        <span style="color: #000000;">&#125;</span>
&nbsp;
    <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>这个类文件，我已详细注释了</p>
<p>使用起来很简单：</p>
<p>//先导入这个类文件，剩下的主要是我对参数的注释，方便大家理解，其实只需要3行代码就可以实现效果了</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">import</span> cn.libins.bitmap.BitmapCuts;
   <span style="color: #3f5fbf;">/*    * Param1 需要运动的对象
         * Param2 横坐标个数
         * Param3 纵坐标个数
         * Param4 小框之间距离
         * Param5 偏移的X坐标
         * Param6 偏移的Y坐标
         * Param7 偏移的Z坐标
         * Param8 偏移的alpha坐标
         * Param9 运动的时间
         */</span>
<span style="color: #6699cc; font-weight: bold;">var</span> cutBitmap<span style="color: #000000; font-weight: bold;">:</span>BitmapCuts = <span style="color: #0033ff; font-weight: bold;">new</span> BitmapCuts<span style="color: #000000;">&#40;</span>mc,<span style="color: #000000; font-weight:bold;">10</span>,<span style="color: #000000; font-weight:bold;">10</span>,<span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight:bold;">0</span>,<span style="color: #000000; font-weight: bold;">-</span><span style="color: #000000; font-weight:bold;">100</span>,<span style="color: #000000; font-weight:bold;">1</span>,<span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>cutBitmap<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>需要注意的是，那个切割的个数，不能过多。。否则运行效率很缓慢</p>
<p>下面是SWF预览效果</p>

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_0" width="550" height="400">
      <param name="movie" value="http://www.minicg.com/blog/wp-content/uploads/2010/01/particle.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://www.minicg.com/blog/wp-content/uploads/2010/01/particle.swf" width="550" height="400">
      <!--<![endif]-->
        <p>The Flash plugin is required to view this object.</p>
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>

]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_158.html/feed</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>制作自己的Flash面板</title>
		<link>http://www.minicg.com/blog/archives/post_124.html</link>
		<comments>http://www.minicg.com/blog/archives/post_124.html#comments</comments>
		<pubDate>Thu, 07 Jan 2010 03:57:14 +0000</pubDate>
		<dc:creator>WaveF</dc:creator>
				<category><![CDATA[技术文档]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[JSFL]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/?p=124</guid>
		<description><![CDATA[Flash 有很多内置面板，调色面板、对齐面板、元件库面板等等。
有时为了工作方便，我们需要自己编写一些脚本加快处理一些重复性较大的工序，这里所说的“脚本”就是 JSFL。
JSFL 全称 Flash JavaScript，它类似于 Microsoft Word 中的“宏”（虽然我不太懂那东西），帮助用户在创作环境中执行重复性任务、或者生成一些特效什么的，但这并不是我们这次所说的重点。
我们今天制作的Flash面板正是调用了JSFL来处理一项重复性较大的任务：快速替换元件库中所有元件中的特定文本。


首先我们来看看熊猫所写的这一段 JSFL：

1
2
3
4
5
6
7
8
9
10
11
var lib = fl.getDocumentDOM&#40;&#41;.library;
 for&#40;var i in lib&#41;&#123;
 for&#40;var j in lib&#91;i&#93;&#41;&#123; //遍历所有库元件
 if&#40;lib&#91;i&#93;&#91;j&#93;.itemType==&#34;graphic&#34;&#124;&#124;lib&#91;i&#93;&#91;j&#93;.itemType==&#34;movie clip&#34;&#41;&#123; //判断，只有图形元件和影片元件里含有文本
 for&#40;var k in lib&#91;i&#93;&#91;j&#93;.timeline.layers&#41;&#123; //遍历图层
 for&#40;var n in lib&#91;i&#93;&#91;j&#93;.timeline.layers&#91;k&#93;.frames&#41;&#123; //遍历所有帧
 for&#40;var m in lib&#91;i&#93;&#91;j&#93;.timeline.layers&#91;k&#93;.frames&#91;n&#93;.elements&#41;&#123; //遍历所有帧里的可视元素
 if&#40;lib&#91;i&#93;&#91;j&#93;.timeline.layers&#91;k&#93;.frames&#91;n&#93;.elements&#91;m&#93; == &#34;[object Text]&#34;&#41;&#123; //只有文本才执行下面的操作
 if&#40;lib&#91;i&#93;&#91;j&#93;.timeline.layers&#91;k&#93;.frames&#91;n&#93;.elements&#91;m&#93;.getTextString&#40;&#41;==&#34;愚蠢的熊猫&#34;&#41;&#123; //获取你需要操作的字符
 lib&#91;i&#93;&#91;j&#93;.timeline.layers&#91;k&#93;.frames&#91;n&#93;.elements&#91;m&#93;.setTextString&#40;&#34;聪明的兔子&#34;&#41;; //替换字符
 &#125;&#125;&#125;&#125;&#125;&#125;&#125;&#125;

这段代码的基本意思就是通过用JSFL把元件库中所有的文本取出来，然后对其内容做判断，进而替换新的内容
（只对元件库中的元件有效）。
01. 现在我们打开Flash，在场景中加入两个输入型的文本框和一个按钮，再加入一些说明文字；

02. 如上图所示，上面的文本框（实例名：ori_txt）我们可以输入查找的字符，
下面的文本框（实例名：new_txt）我们可以输入要替换成的字符，
最下面的按钮（实例名：btn）是用来执行JSFL的。
03. 接下来我们在AS层加入代码。首先为按钮编写侦听点击事件和执行函数：

1
2
3
4
5
6
7
8
btn.addEventListener&#40;MouseEvent.CLICK, runScript&#41;;
&#160;
function runScript [...]]]></description>
			<content:encoded><![CDATA[<p>Flash 有很多内置面板，调色面板、对齐面板、元件库面板等等。<br />
有时为了工作方便，我们需要自己编写一些脚本加快处理一些重复性较大的工序，这里所说的“脚本”就是 JSFL。</p>
<p>JSFL 全称 Flash JavaScript，它类似于 Microsoft Word 中的“宏”（虽然我不太懂那东西），帮助用户在创作环境中执行重复性任务、或者生成一些特效什么的，但这并不是我们这次所说的重点。</p>
<p>我们今天制作的Flash面板正是调用了JSFL来处理一项重复性较大的任务：快速替换元件库中所有元件中的特定文本。</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/00.gif" class="highslide-image" onclick="return hs.expand(this);"><img src="http://www.minicg.com/blog/wp-content/uploads/2010/01/00.gif" alt="" title="00" width="432" height="400" class="alignnone size-full wp-image-130" /></a></p>
<p><span id="more-124"></span><br />
首先我们来看看熊猫所写的这一段 JSFL：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code"><pre class="javascript" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #003366; font-weight: bold;">var</span> lib <span style="color: #339933;">=</span> fl.<span style="color: #660066;">getDocumentDOM</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">library</span><span style="color: #339933;">;</span>
 <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
 <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//遍历所有库元件</span>
 <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">itemType</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;graphic&quot;</span><span style="color: #339933;">||</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">itemType</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;movie clip&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//判断，只有图形元件和影片元件里含有文本</span>
 <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> k <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//遍历图层</span>
 <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> n <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//遍历所有帧</span>
 <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//遍历所有帧里的可视元素</span>
 <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">&quot;[object Text]&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//只有文本才执行下面的操作</span>
 <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getTextString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;愚蠢的熊猫&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span> <span style="color: #006600; font-style: italic;">//获取你需要操作的字符</span>
 lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">setTextString</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;聪明的兔子&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #006600; font-style: italic;">//替换字符</span>
 <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>这段代码的基本意思就是通过用JSFL把元件库中所有的文本取出来，然后对其内容做判断，进而替换新的内容<br />
（只对元件库中的元件有效）。</p>
<p>01. 现在我们打开Flash，在场景中加入两个输入型的文本框和一个按钮，再加入一些说明文字；</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/01.gif" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-125" title="01" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/01.gif" alt="" width="202" height="434" /></a></p>
<p>02. 如上图所示，上面的文本框（实例名：ori_txt）我们可以输入查找的字符，<br />
下面的文本框（实例名：new_txt）我们可以输入要替换成的字符，<br />
最下面的按钮（实例名：btn）是用来执行JSFL的。</p>
<p>03. 接下来我们在AS层加入代码。首先为按钮编写侦听点击事件和执行函数：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
</pre></td><td class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">btn.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>, runScript<span style="color: #000000;">&#41;</span>;
&nbsp;
<span style="color: #339966; font-weight: bold;">function</span> runScript <span style="color: #000000;">&#40;</span>e<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
 <span style="color: #6699cc; font-weight: bold;">var</span> otxt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = ori_txt.<span style="color: #004993;">text</span>; <span style="color: #009900;">//点击按钮后读入文本框的字符</span>
 <span style="color: #6699cc; font-weight: bold;">var</span> ntxt<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = new_txt.<span style="color: #004993;">text</span>; <span style="color: #009900;">//同上</span>
 <span style="color: #6699cc; font-weight: bold;">var</span> jsfl<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span>;
 MMExecute<span style="color: #000000;">&#40;</span>jsfl<span style="color: #000000;">&#41;</span>;
 <span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>大家可以留意到 <strong><span style="color: #008000;">MMExecute();</span></strong> 这东西，它就是用来执行JSFL脚本的。<br />
而我们预留了一个叫“JSFL”的字符型变量，这将被用来装载熊猫所写的JSFL脚本。</p>
<p>04. 特别需要留意的是我们的JSFL到了ActionScript必须变成一个字符串，所以我们得对准备好的JSFL做以下事情：</p>
<p>- 把特殊字符用转义字符处理好；<br />
- 双引号变单引号；<br />
- 把所有代码变成一行；</p>
<p>于是我们得到没有换行的代码：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #003366; font-weight: bold;">var</span> lib <span style="color: #339933;">=</span> fl.<span style="color: #660066;">getDocumentDOM</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">library</span><span style="color: #339933;">;</span>for<span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> j <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">itemType</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'graphic'</span><span style="color: #339933;">||</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">itemType</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'movie clip'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> k <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> n <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> m <span style="color: #000066; font-weight: bold;">in</span> lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'[object Text]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">getTextString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">==</span><span style="color: #3366CC;">'愚蠢的熊猫'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>lib<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span>j<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">timeline</span>.<span style="color: #660066;">layers</span><span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">frames</span><span style="color: #009900;">&#91;</span>n<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">elements</span><span style="color: #009900;">&#91;</span>m<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">setTextString</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'聪明的兔子'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span><span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>05. 这个时候基本上把上面的代码代入JSFL变量就好了，但是那只能把“愚蠢的熊猫”变成“聪明的兔子”，<br />
我们的文本框干嘛去了……</p>
<p>所以我们得把代码断开，断在“愚蠢的熊猫”和“聪明的兔子”处，为了好看，我们用这么几个字符型变量装载着：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>6
7
8
9
10
</pre></td><td class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #6699cc; font-weight: bold;">var</span> str1<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;fl.outputPanel.clear();fl.outputPanel.trace('Start replacing text...');var lib = fl.getDocumentDOM().library;&quot;</span>
<span style="color: #6699cc; font-weight: bold;">var</span> str2<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;for(var i in lib){for(var j in lib[i]){if (lib[i][j].itemType=='graphic'||lib[i][j].itemType=='movie clip'||lib[i][j].itemType=='button'){for(var k in lib[i][j].timeline.layers){for(var n in lib[i][j].timeline.layers[k].frames){for(var m in lib[i][j].timeline.layers[k].frames[n].elements){if(lib[i][j].timeline.layers[k].frames[n].elements[m]=='[object Text]'){if(lib[i][j].timeline.layers[k].frames[n].elements[m].getTextString()=='&quot;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> str3<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;'){lib[i][j].timeline.layers[k].frames[n].elements[m].setTextString('&quot;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> str4<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;');fl.outputPanel.trace('---');}}}}}}}}&quot;</span>;
<span style="color: #6699cc; font-weight: bold;">var</span> str5<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = <span style="color: #990000;">&quot;fl.outputPanel.trace('All text replaced.');&quot;</span>;</pre></td></tr></table></div>

<p>上面我加入了 <span style="color: #008000;">fl.outputPanel.clear()</span> 和 <span style="color: #008000;">fl.outputPanel.trace()</span>，它们会在输出面板清除和显示文本，用来提醒用户脚本的执行情况。</p>
<p>06. 通过第5步把代码断开以后，我们就在第6步把代码重新组合起来，这时可以把从文本框取得的变量包括进来了：</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>11
12
</pre></td><td class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #6699cc; font-weight: bold;">var</span> jsfl<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">String</span> = str1 <span style="color: #000000; font-weight: bold;">+</span> str2 <span style="color: #000000; font-weight: bold;">+</span> otxt <span style="color: #000000; font-weight: bold;">+</span> str3 <span style="color: #000000; font-weight: bold;">+</span> ntxt <span style="color: #000000; font-weight: bold;">+</span> str4 <span style="color: #000000; font-weight: bold;">+</span> str5;
MMExecute<span style="color: #000000;">&#40;</span>jsfl<span style="color: #000000;">&#41;</span>;</pre></td></tr></table></div>

<p>07. 至此Flash部分就完成了，我们按照FlashPlayer9，AS3输出SWF，然后把这个SWF放到以下路径就完事了：<br />
<span style="color: #ff0000;"> X</span>:\Documents and Settings\<span style="color: #ff0000;">UserName</span>\Local Settings\Application Data\Adobe\<span style="color: #ff0000;">Flash CS4</span>\<span style="color: #ff0000;">zh_cn</span>\Configuration\WindowSWF<br />
(红色部分按实际情况替换)</p>
<p>08. 终于大功告成了，打开Flash，在菜单“窗口 &#8212; 其他面板”下就可以找到你刚才创作的面板，欢呼吧！</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/08.gif" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-126" title="08" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/08.gif" alt="" width="423" height="623" /></a></p>
<p>09. 请把第7步的SWF文件删掉……</p>
<p>10. 都 2010 了，怎么也得搞点新意思，确保你已经安装了“Adobe Extension Manager”，打开你的记事本，把下面的代码粘贴进去：</p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="xml" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;?xml</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span> <span style="color: #000066;">encoding</span>=<span style="color: #ff0000;">&quot;UTF-8&quot;</span><span style="color: #000000; font-weight: bold;">?&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;macromedia-extension</span></span>
<span style="color: #009900;"><span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;ReplaceText&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;1.0&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">type</span>=<span style="color: #ff0000;">&quot;flashpanel&quot;</span></span>
<span style="color: #009900;"><span style="color: #000066;">requires-restart</span>=<span style="color: #ff0000;">&quot;true&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;author</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Libins&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span> 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;products<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;product</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">&quot;Flash&quot;</span> <span style="color: #000066;">version</span>=<span style="color: #ff0000;">&quot;9&quot;</span> <span style="color: #000066;">primary</span>=<span style="color: #ff0000;">&quot;true&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/products<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #339933;">&lt;![CDATA[ Quickly replace text on the Library - miniCG.com ]]&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/description<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;ui-access<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #339933;">&lt;![CDATA[ Access the Renamer Panel by selecting 'Window &gt; Other Panels &gt; ReplaceText'. ]]&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/ui-access<span style="color: #000000; font-weight: bold;">&gt;</span></span></span> 
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;license-agreement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #339933;">&lt;![CDATA[]]&gt;</span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/license-agreement<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;file</span> <span style="color: #000066;">source</span>=<span style="color: #ff0000;">&quot;ReplaceText.swf&quot;</span> <span style="color: #000066;">destination</span>=<span style="color: #ff0000;">&quot;$flash/WindowSWF&quot;</span> <span style="color: #000000; font-weight: bold;">/&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/files<span style="color: #000000; font-weight: bold;">&gt;</span></span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/macromedia-extension<span style="color: #000000; font-weight: bold;">&gt;</span></span></span></pre></td></tr></table></div>

<p>这是典型的XML，我不说了…… 直接保存为 UTF-8 编码、扩展名为“mxi”的文件，不会的话面壁去。</p>
<p>11. 运行 Adobe Extension Manager，在文件菜单下找到“封装扩充功能”的选项<br />
（简体中文版的名字可能会有点不同），<br />
点击之后对弹出个对话框，选择刚才保存的 mxi文件点确定（swf必须和mxi放在一起），紧接着会弹出对话框让你保存封包好的 mxp文件。<br />
这个 mxp文件可以通过双击来安装你制作的扩展面板，双击之后 Adobe Extension Manager 会自动运行，<br />
显示一堆法律条文后问你是不是要安装这个扩展面板。这能让用户把第7步那条该死的路径彻底忘掉，<br />
通过一个简单的 mxp文件就可以让更多的用户分享你的作品。</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/11.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-127" title="11" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/11.jpg" alt="" width="600" height="400" /></a></p>
<p> <img src='http://www.minicg.com/blog/wp-includes/images/smilies/icon_upload_16.gif' alt=':down:' class='wp-smiley' />  <a href='http://www.minicg.com/blog/wp-content/uploads/2010/01/ReplaceText.zip'>ReplaceText &#8211; 源文件下载</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_124.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3放大镜工具类</title>
		<link>http://www.minicg.com/blog/archives/post_64.html</link>
		<comments>http://www.minicg.com/blog/archives/post_64.html#comments</comments>
		<pubDate>Wed, 06 Jan 2010 03:38:46 +0000</pubDate>
		<dc:creator>Libins</dc:creator>
				<category><![CDATA[技术文档]]></category>
		<category><![CDATA[ActionScript]]></category>
		<category><![CDATA[AS3]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/?p=64</guid>
		<description><![CDATA[之前在天地会看到有人询问此功能的做法，又有网友贴出了一个国外类似功能的，
出处在：http://www.flashandmath.com/intermediate/magglass/index.html
它这个使用不太方便，所以我自己把它的功能做成了一个类文件，方便使用，代码如下。


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
package cn.libins.tool&#123;
 import flash.display.Bitmap;
 import flash.display.BitmapData;
 import flash.display.DisplayObject;
 import flash.display.DisplayObjectContainer;
 import flash.display.Sprite;
 import flash.geom.Point;
 import flash.geom.Rectangle;
 import flash.ui.Mouse;
 import flash.events.Event;
 import flash.events.MouseEvent;
 import flash.filters.DropShadowFilter;
&#160;
 public class MagGlass extends Sprite &#123;
  private const MAXSIZE       :uint  = 2880;
  private var _zoom           :Number;
  private var _zoomSmall      :Number;
  private var _imageW         :Number;
  private var _imageH         :Number;
  private var _imageBitmap    :Bitmap;
  private var _newBitmap      :Bitmap;
  private var _imageBitmapData:BitmapData;
  private var _dataW          :Number;
  private var _dataH          :Number;
  private var _filtered       :Boolean;
  private var _glassSp        :Sprite;
  private [...]]]></description>
			<content:encoded><![CDATA[<p>之前在天地会看到有人询问此功能的做法，又有网友贴出了一个国外类似功能的，<br />
出处在：<a href="http://www.flashandmath.com/intermediate/magglass/index.html">http://www.flashandmath.com/intermediate/magglass/index.html</a></p>
<p>它这个使用不太方便，所以我自己把它的功能做成了一个类文件，方便使用，代码如下。<br />
<span id="more-64"></span></p>

<div class="wp_syntax"><table><tr><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
</pre></td><td class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #9900cc; font-weight: bold;">package</span> cn.libins.tool<span style="color: #000000;">&#123;</span>
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Bitmap</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">BitmapData</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">DisplayObject</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">DisplayObjectContainer</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #004993;">Sprite</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">Point</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.geom</span>.<span style="color: #004993;">Rectangle</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.ui</span>.<span style="color: #004993;">Mouse</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">Event</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.events</span>.<span style="color: #004993;">MouseEvent</span>;
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.filters</span>.<span style="color: #004993;">DropShadowFilter</span>;
&nbsp;
 <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MagGlass extends <span style="color: #004993;">Sprite</span> <span style="color: #000000;">&#123;</span>
  <span style="color: #0033ff; font-weight: bold;">private</span> const MAXSIZE       <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>  = <span style="color: #000000; font-weight:bold;">2880</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _zoom           <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _zoomSmall      <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _imageW         <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _imageH         <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _imageBitmap    <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Bitmap</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _newBitmap      <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Bitmap</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _imageBitmapData<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _dataW          <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _dataH          <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _filtered       <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _glassSp        <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _isZooming      <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _Stage          <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Object</span>;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> _target         <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span>;
   <span style="color: #3f5fbf;">/*
   * Param1 需要缩放的对象
   * Param2 缩放的倍数,默认为3倍
   * Param3 显示框的宽度
   * Param4 显示框的高度
   * Param5 是否添加阴影滤镜
   */</span>
  <span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MagGlass<span style="color: #000000;">&#40;</span>$target<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span>, $zoom<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">3</span>, $width<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">100</span>, $height<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">80</span>, $filtered<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Boolean</span> = <span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;MagGlass v01&quot;</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>$target <span style="color: #0033ff; font-weight: bold;">is</span> <span style="color: #004993;">Bitmap</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
        _imageBitmap = $target <span style="color: #0033ff; font-weight: bold;">as</span> <span style="color: #004993;">Bitmap</span>;
   <span style="color: #000000;">&#125;</span><span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span>
     _imageBitmap = getBitmap<span style="color: #000000;">&#40;</span>$target<span style="color: #000000;">&#41;</span>;
   <span style="color: #000000;">&#125;</span>
   _imageBitmap.<span style="color: #004993;">scaleX</span> = $zoom;
   _imageBitmap.<span style="color: #004993;">scaleY</span> = $zoom;
   <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>_imageBitmap.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">&gt;</span> MAXSIZE <span style="color: #000000; font-weight: bold;">||</span> _imageBitmap.<span style="color: #004993;">width</span> <span style="color: #000000; font-weight: bold;">&gt;</span> MAXSIZE<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
      <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span><span style="color: #990000;">&quot;图片尺寸超过范围！&quot;</span><span style="color: #000000;">&#41;</span>;
         <span style="color: #0033ff; font-weight: bold;">return</span>;
   <span style="color: #000000;">&#125;</span>
   <span style="color: #6699cc; font-weight: bold;">var</span> newSp<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Sprite</span>    = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
   newSp.<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_imageBitmap<span style="color: #000000;">&#41;</span>;
   _newBitmap          = getBitmap<span style="color: #000000;">&#40;</span>newSp<span style="color: #000000;">&#41;</span>;
   _imageBitmapData    = _newBitmap.<span style="color: #004993;">bitmapData</span>;
   _target             = $target;
   _zoom               = $zoom;
   _imageW             = $width;
   _imageH             = $height;
   _filtered           = $filtered;
   <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ADDED_TO_STAGE</span>, addToStage<span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> addToStage<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Event</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Event</span>.<span style="color: #004993;">ADDED_TO_STAGE</span>, addToStage<span style="color: #000000;">&#41;</span>;
   _Stage = <span style="color: #004993;">stage</span>;
   initGlass<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
   initEvent<span style="color: #000000;">&#40;</span>_target<span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> initGlass<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   _glassSp = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Sprite</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
   _glassSp.<span style="color: #004993;">buttonMode</span> = _glassSp.<span style="color: #004993;">mouseChildren</span> = _glassSp.<span style="color: #004993;">mouseEnabled</span> = <span style="color: #0033ff; font-weight: bold;">false</span>;
   <span style="color: #0033ff; font-weight: bold;">if</span><span style="color: #000000;">&#40;</span>_filtered<span style="color: #000000;">&#41;</span> _glassSp.<span style="color: #004993;">filters</span> = <span style="color: #000000;">&#91;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">DropShadowFilter</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#93;</span>;
   <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>_glassSp<span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> initEvent<span style="color: #000000;">&#40;</span>$target<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
    $target.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">ROLL_OUT</span>,  targetOut,<span style="color: #0033ff; font-weight: bold;">true</span><span style="color: #000000;">&#41;</span>;
             $target.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_DOWN</span>, targetDown<span style="color: #000000;">&#41;</span>;
       _Stage.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_UP</span>,  targetOut<span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> targetDown<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
   _isZooming = <span style="color: #0033ff; font-weight: bold;">true</span>;
   <span style="color: #004993;">Mouse</span>.<span style="color: #004993;">hide</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #6699cc; font-weight: bold;">var</span> hitPoint<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span>event.<span style="color: #004993;">localX</span>, event.<span style="color: #004993;">localY</span><span style="color: #000000;">&#41;</span>;
   <span style="color: #009900;">//trace(&quot;hitPoint&quot;,hitPoint);</span>
   _glassSp.<span style="color: #004993;">x</span> = <span style="color: #0033ff; font-weight: bold;">this</span>.mouseX<span style="color: #000000; font-weight: bold;">-</span> _imageW <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
   _glassSp.<span style="color: #004993;">y</span> = <span style="color: #0033ff; font-weight: bold;">this</span>.mouseY<span style="color: #000000; font-weight: bold;">-</span> _imageH <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
   ShowBig<span style="color: #000000;">&#40;</span>hitPoint<span style="color: #000000;">&#41;</span>;
&nbsp;
   <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_MOVE</span>,targetMove<span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span>  <span style="color: #339966; font-weight: bold;">function</span> glassClear<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
       _glassSp.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
     <span style="color: #000000;">&#125;</span>
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> targetOut<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
    _isZooming = <span style="color: #0033ff; font-weight: bold;">false</span>;
    glassClear<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #004993;">Mouse</span>.<span style="color: #004993;">show</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    <span style="color: #0033ff; font-weight: bold;">this</span>.<span style="color: #004993;">removeEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">MOUSE_MOVE</span>,targetMove<span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> targetMove<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
      <span style="color: #6699cc; font-weight: bold;">var</span> movePoint<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span>_target.<span style="color: #004993;">mouseX</span>, _target.<span style="color: #004993;">mouseY</span><span style="color: #000000;">&#41;</span>;
      <span style="color: #009900;">//trace(&quot;movePoint&quot;,movePoint);</span>
      _glassSp.<span style="color: #004993;">x</span>         = <span style="color: #0033ff; font-weight: bold;">this</span>.mouseX<span style="color: #000000; font-weight: bold;">-</span> _imageW <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
      _glassSp.<span style="color: #004993;">y</span>         = <span style="color: #0033ff; font-weight: bold;">this</span>.mouseY<span style="color: #000000; font-weight: bold;">-</span> _imageH <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
      ShowBig<span style="color: #000000;">&#40;</span>movePoint<span style="color: #000000;">&#41;</span>;
      event.<span style="color: #004993;">updateAfterEvent</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> getBitmap<span style="color: #000000;">&#40;</span>$target<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">DisplayObject</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Bitmap</span> <span style="color: #000000;">&#123;</span>
   <span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">bitmapData</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span>$target.<span style="color: #004993;">width</span>, $target.<span style="color: #004993;">height</span>,<span style="color: #0033ff; font-weight: bold;">true</span>,0xffff0000<span style="color: #000000;">&#41;</span>;
   <span style="color: #004993;">bitmapData</span>.<span style="color: #004993;">draw</span><span style="color: #000000;">&#40;</span>$target<span style="color: #000000;">&#41;</span>;
   <span style="color: #0033ff; font-weight: bold;">return</span> <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Bitmap</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">bitmapData</span><span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #3f5fbf;">/*
   * Param1 坐标,即需要显示的坐标中点
   */</span>
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> ShowBig<span style="color: #000000;">&#40;</span>$point<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
   drawGlass<span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span>$point.<span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">*</span>_zoom,$point.<span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">*</span>_zoom<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
&nbsp;
  <span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #339966; font-weight: bold;">function</span> drawGlass<span style="color: #000000;">&#40;</span>$point<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Point</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span>
    <span style="color: #6699cc; font-weight: bold;">var</span> curBitmapData<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">BitmapData</span>;
    <span style="color: #6699cc; font-weight: bold;">var</span> curBitmap    <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Bitmap</span>;
    <span style="color: #6699cc; font-weight: bold;">var</span> startX       <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = $point.<span style="color: #004993;">x</span> <span style="color: #000000; font-weight: bold;">-</span> _imageW <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
    <span style="color: #6699cc; font-weight: bold;">var</span> startY       <span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = $point.<span style="color: #004993;">y</span> <span style="color: #000000; font-weight: bold;">-</span> _imageH <span style="color: #000000; font-weight: bold;">/</span> <span style="color: #000000; font-weight:bold;">2</span>;
    curBitmap                = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Bitmap</span><span style="color: #000000;">&#40;</span><span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">BitmapData</span><span style="color: #000000;">&#40;</span>_imageW, _imageH<span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    curBitmap.<span style="color: #004993;">bitmapData</span>.<span style="color: #004993;">copyPixels</span><span style="color: #000000;">&#40;</span>_imageBitmapData, <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Rectangle</span><span style="color: #000000;">&#40;</span>startX, startY, _imageW, _imageH<span style="color: #000000;">&#41;</span>, <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Point</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span><span style="color: #000000;">&#41;</span>;
    curBitmapData            = curBitmap.<span style="color: #004993;">bitmapData</span>;
    _glassSp.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">clear</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    _glassSp.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">lineStyle</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
    _glassSp.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">beginBitmapFill</span><span style="color: #000000;">&#40;</span>curBitmapData<span style="color: #000000;">&#41;</span>;
    _glassSp.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">drawRect</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">0</span>, <span style="color: #000000; font-weight:bold;">0</span>, _imageW, _imageH<span style="color: #000000;">&#41;</span>;
    _glassSp.<span style="color: #004993;">graphics</span>.<span style="color: #004993;">endFill</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
  <span style="color: #000000;">&#125;</span>
 <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></td></tr></table></div>

<p>使用也很简单，可以对舞台的可视对象进行缩放</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">import</span> cn.libins.tool.MagGlass;
<span style="color: #6699cc; font-weight: bold;">var</span> mMagGlass<span style="color: #000000; font-weight: bold;">:</span>MagGlass = <span style="color: #0033ff; font-weight: bold;">new</span> MagGlass<span style="color: #000000;">&#40;</span>mc,<span style="color: #000000; font-weight:bold;">5</span>,<span style="color: #000000; font-weight:bold;">150</span>,<span style="color: #000000; font-weight:bold;">150</span><span style="color: #000000;">&#41;</span>;
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>mMagGlass<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>这样我们就可以对舞台，实例为mc的对象进行缩放了。</p>
<p><strong><span style="color: #ff0066;"> ～请在下图中点击鼠标预览效果～</span></strong><br />

    <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" id="swfobj_1" width="600" height="450">
      <param name="movie" value="http://www.minicg.com/blog/wp-content/uploads/2010/01/mag_glass.swf" />
      <!--[if !IE]>-->
      <object type="application/x-shockwave-flash" data="http://www.minicg.com/blog/wp-content/uploads/2010/01/mag_glass.swf" width="600" height="450">
      <!--<![endif]-->
        <p>The Flash plugin is required to view this object.</p>
      <!--[if !IE]>-->
      </object>
      <!--<![endif]-->
    </object>
</p>
]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_64.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ActionScript 3.0 Game Programming University [配对游戏翻译]</title>
		<link>http://www.minicg.com/blog/archives/post_26.html</link>
		<comments>http://www.minicg.com/blog/archives/post_26.html#comments</comments>
		<pubDate>Mon, 04 Jan 2010 02:48:51 +0000</pubDate>
		<dc:creator>Libins</dc:creator>
				<category><![CDATA[技术文档]]></category>
		<category><![CDATA[AS3]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/?p=26</guid>
		<description><![CDATA[书名顾名思义，可以理解AS3.0游戏编程大学
这个书，从常用的游戏基础知识讲起，然后外加7-8个游戏范本，从无到有，从简单到复杂，循序渐进的方式教学，很适合第一次以AS3.0开发游戏的人员学习。我个人认为此书比较系统的讲解了每个基础点的知识，让人学后就会灵活使用的好书。
如果大家有英语基础知识的话，可以下载英文原版看看。
今天我翻译的一个游戏教程是：配对游戏
游戏虽然简单，但是翻译的工作量比较大，因为自己明白了不是真正的明白，要把明白的东西写出来让大家明白才是真的明白，所以转载的话，麻烦大家不要编辑掉我的博客地址，因为我会在陆续的时间里，接着翻译书本剩下的游戏 
 http://www.gotoandstop.cn
或者这个地址：
http://www.minicg.com/blog/2010/01/04/actionscript-3-game-programming-university.html

（1）Placing Interactive Elements     定义配对的卡片
（2）Game Play                              开始游戏
（3）Encapsulating the Game           游戏的整合封装
（4）Adding Scoring [...]]]></description>
			<content:encoded><![CDATA[<p>书名顾名思义，可以理解AS3.0游戏编程大学<br />
这个书，从常用的游戏基础知识讲起，然后外加7-8个游戏范本，从无到有，从简单到复杂，循序渐进的方式教学，很适合第一次以AS3.0开发游戏的人员学习。我个人认为此书比较系统的讲解了每个基础点的知识，让人学后就会灵活使用的好书。<br />
如果大家有英语基础知识的话，可以下载英文原版看看。</p>
<p>今天我翻译的一个游戏教程是：配对游戏<br />
游戏虽然简单，但是翻译的工作量比较大，因为自己明白了不是真正的明白，要把明白的东西写出来让大家明白才是真的明白，所以转载的话，麻烦大家不要编辑掉我的博客地址，因为我会在陆续的时间里，接着翻译书本剩下的游戏 <img src='http://www.minicg.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /><br />
<a href="http://www.gotoandstop.cn" target="_blank"> http://www.gotoandstop.cn</a><br />
或者这个地址：<br />
<a href="http://www.minicg.com/blog/2010/01/04/actionscript-3-game-programming-university.html">http://www.minicg.com/blog/2010/01/04/actionscript-3-game-programming-university.html</a></p>
<p><span id="more-26"></span></p>
<p>（1）Placing Interactive Elements     定义配对的卡片<br />
（2）Game Play                              开始游戏<br />
（3）Encapsulating the Game           游戏的整合封装<br />
（4）Adding Scoring and a Clock       添加游戏积分和时间的控制<br />
（5）Adding Game Effects               添加游戏的效果<br />
（6）Modifying the Game                 游戏的修改</p>
<p>（1）定义配对的卡片<br />
创建配对图片的方法：</p>
<p>一.Multiple-Symbol Method 创建多个元件<br />
创建多个元件配对的方式，就是一个影片元件代表一个卡片，假如我们这个游戏需要36个卡片，因为是配对游戏，所以实际所需的卡片数位36/2=18个，这样我们就需要18个独立的元件。这样就给我们带来一些问题：<br />
1.我们需要复制17次相同的元件，因为每个卡片都有自己共同的特点，就是边框和背景色。当然你可能会想到，解决这个方法，就是弄一个背景色的图形元件解决此类问题。<br />
2.同样一个问题，就是如果将来我们需要改变卡片的话，例如，我们需要重设这个卡片的尺寸的话，我们需要同时修改其他的卡片18次。<br />
假如你只是一个程序员的话，因为界面图形都需要其他设计师设计的话，设计师要更换图片符号的话，需要一定的时间，这样效率不是最好的。</p>
<p>二.Single-Symbol Method 一个简单的元件<br />
第二个方法就是设置一个单独的影片剪辑了，我们只需要一个影片剪辑，但是里面是多帧的，也就是说，每帧里有不同的图片符号内容。这样我们就可以在单独的一层里放置这个背景和图形，这样每个帧里都可以用上。<br />
这样的好处在于以后更新内容尺寸的话，会非常的方便，我们很容易的找到我们需要修改的内容。同时我们也会很方便的从其他设计师手里得到这个更新的影片剪辑</p>
<p>[题外话]最方便的还是利用xml+外部pic来实现，这样只需要在外部修改图片，就可以更改游戏内容了，因为所翻译的游戏暂时没有提到，我这里就略过了，等整个游戏结束后，抽空在把这部分加上。</p>
<p>Setting Up the Flash Movie<br />
flash里的影片剪辑设置<br />
我们在库里至少需要一个影片剪辑，这个影片剪辑包括所有的我们需要的配对内容。当然，我们这个影片剪辑第一帧就是默认的卡片背部，就是没有点击时卡片的显示状态。</p>
<p>现在我们需要在这个影片剪辑里创建19个关键帧，第一帧是默认的初始状态，后面的就是单个关键帧对应一个图形。状态如下图：</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_1.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-27" title="01" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_1.jpg" alt="" width="326" height="257" /></a></p>
<p>在库里找到这个影片剪辑，然后右键链接里进行一些参数的设置。如下图：</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_2.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-28" title="02" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_2.jpg" alt="" width="300" height="330" /></a></p>
<p>Base Class默认为MovieClip，Class类名，我们设置为Card。<br />
好了，现在基本工作做好了，我们的主场景里啥也没有，只是在库里有一个影片剪辑，现在我们需要的工作就是开始我们的代码设计了。</p>
<p>Creating the Basic ActionScript Class<br />
现在我们需要创建一个文档类了，在flash里新建一个AS文件。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #9900cc; font-weight: bold;">package</span> <span style="color: #000000;">&#123;</span>
 <span style="color: #0033ff; font-weight: bold;">import</span> <span style="color: #004993;">flash.display</span>.<span style="color: #000000; font-weight: bold;">*</span>;
 <span style="color: #000000;">&#125;</span></pre></div></div>

<p>我们开始我们这个类文件的书写了。我们可以看到这部分代码，package就是我们通知flash引擎,我们的类文件所在的路径。import flash.display.*;这部分，就是告诉引擎，我们需要导入这个显示类包，这样我们可以就可以导入这个包下的所有的子类文件了。这样我们才能创建和控制想卡片这样的影片剪辑。</p>
<p>接下来我们需要申明我们的类文件了：</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MatchingGame1 extends <span style="color: #004993;">MovieClip</span></pre></div></div>

<p>请注意，此时的类名和我们的这个类文件名要统一<br />
接下来就是定义一些类属性了，我们当前要做的就是在屏幕生成36个卡片，所以我们暂时不需要定义属性，等有需要的时候在加上。：）<br />
现在要做的就是申明一个构造函数了，它也是和类名，文件名同名的。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> MatchingGame1<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #0033ff; font-weight: bold;">void</span> <span style="color: #000000;">&#123;</span></pre></div></div>

<p>现在我们开始构造我们的那36个卡片吧，我们期望的是6×6型的排列方式，因此我们需要2个循环函数</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span>;x<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000; font-weight:bold;">6</span>;x<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
<span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span>;y<span style="color: #000000; font-weight: bold;">&lt;</span><span style="color: #000000; font-weight:bold;">6</span>;y<span style="color: #000000; font-weight: bold;">++</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></pre></div></div>

<p>第一个循环函数，是对x坐标进行控制的，后一个循环就是对y坐标进行控制的。</p>
<p>接下来我们要进行一些属性的设置，来控制卡片的具体位置和显示的方式。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #6699cc; font-weight: bold;">var</span> thisCard<span style="color: #000000; font-weight: bold;">:</span>Card = <span style="color: #0033ff; font-weight: bold;">new</span> Card<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">//从库里复制一个元件</span>
thisCard.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;               <span style="color: #009900;">//让其停止在第一帧，就是初始时的显示</span>
thisCard.<span style="color: #004993;">x</span> = <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">52</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">120</span>;         <span style="color: #009900;">//120是卡片的x坐标偏移位置，52，就是卡片的间距</span>
thisCard.<span style="color: #004993;">y</span> = <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">*</span><span style="color: #000000; font-weight:bold;">52</span><span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">45</span>;          <span style="color: #009900;">//45就是y坐标的偏移位置，52也是间距</span>
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>thisCard<span style="color: #000000;">&#41;</span>;            <span style="color: #009900;">//这个很关键，所有的显示的物件，都必须addChild后才能在显示列表里显示出来，否则我们是看不到的。</span></pre></div></div>

<p>好了，基本工作做好了，我们开始进行检测的测试下吧，这个新建的文档类，我们可以直接在属性面板里设定，如下图：</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_3.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-29" title="03" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_3.jpg" alt="" width="575" height="74" /></a></p>
<p>设置好了，发布试试看，有什么结果。</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_4.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-30" title="04" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_4.jpg" alt="" width="380" height="351" /></a></p>
<p>Using Constants for Better Coding<br />
在我们进行下一步的操作前，我们开始看看，我们现在需要解决的手头问题是什么</p>
<p>假如你不需要6×6，而需要4×4，或者需要6×5排列方式的话，我们只需要在上面所提到的循环体里修改合适的参数就可以实现了，这里就留给大家自己去测试吧。。。偷懒了。。</p>
<p>大家经过几次测试后，会感觉到这个循环体的特点了，现在我们把那几个以后会改动的参数拿出来，以类属性的方式来定义他们，以后修改的话，就不需要在代码里去找了，直接修改变量值就可以轻松实现了。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">Horizontal Rows = <span style="color: #000000; font-weight:bold;">6</span>
Vertical Rows = <span style="color: #000000; font-weight:bold;">6</span>
Horizontal Spacing = <span style="color: #000000; font-weight:bold;">52</span>
Vertical Spacing = <span style="color: #000000; font-weight:bold;">52</span>
Horizontal Screen Offset = <span style="color: #000000; font-weight:bold;">120</span>
Vertical Screen Offset = <span style="color: #000000; font-weight:bold;">45</span>
&nbsp;
<span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #9900cc; font-weight: bold;">class</span> MatchingGame2 extends <span style="color: #004993;">MovieClip</span> <span style="color: #000000;">&#123;</span>
<span style="color: #009900;">// game constants</span>
<span style="color: #0033ff; font-weight: bold;">private</span> static const boardWidth<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">6</span>;
<span style="color: #0033ff; font-weight: bold;">private</span> static const boardHeight<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #000000; font-weight:bold;">6</span>;
<span style="color: #0033ff; font-weight: bold;">private</span> static const cardHorizontalSpacing<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">52</span>;
<span style="color: #0033ff; font-weight: bold;">private</span> static const cardVerticalSpacing<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">52</span>;
<span style="color: #0033ff; font-weight: bold;">private</span> static const boardOffsetX<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">120</span>;
<span style="color: #0033ff; font-weight: bold;">private</span> static const boardOffsetY<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Number</span> = <span style="color: #000000; font-weight:bold;">45</span>;</pre></div></div>

<p>private 是私有的意思，就是只有这个类里可以访问到的 static静态的话，就是说以后假如还会扩展这个类的话，他们这个属性是共有的，是这个类所有的共性。 Const常量，就是说这个值不可以修改。<br />
现在有了变量的话，我们要做的工作就是把之前循环体里的数据，替换为我们定义的变量了</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #6699cc; font-weight: bold;">var</span> thisCard<span style="color: #000000; font-weight: bold;">:</span>Card = <span style="color: #0033ff; font-weight: bold;">new</span> Card<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
thisCard.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
thisCard.<span style="color: #004993;">x</span> = <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">*</span>cardHorizontalSpacing<span style="color: #000000; font-weight: bold;">+</span>boardOffsetX;
thisCard.<span style="color: #004993;">y</span> = <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">*</span>cardVerticalSpacing<span style="color: #000000; font-weight: bold;">+</span>boardOffsetY;
<span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span>thisCard<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>好了，现在的这个类设置好了，我们可以测试了，我们尝试的修改变量值，看会有什么结果。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">Shuffling and Assigning Cards</pre></div></div>

<p>现在的卡片已经在舞台上显示了，我们现在需要的是这些卡片中的图片能随机的出现在每个位置。我们当前是拥有36个卡片在舞台上，因为是配对游戏，我们只需要18组不同的卡片在随机的位置。</p>
<p>为了解决这个问题，我们需要一个数组来保存我们这些卡片，然后随机的从数组里抽取卡片。这个数组有36个，即18组卡片，每次从数组里抽取一个卡片后，我们就从这个数组里删去所抽取的卡片，同时在舞台上让其显示出来。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #6699cc; font-weight: bold;">var</span> cardlist<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">Array</span> = <span style="color: #0033ff; font-weight: bold;">new</span> <span style="color: #004993;">Array</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;
 <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> i<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span>;icardlist.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span>;
 cardlist.<span style="color: #004993;">push</span><span style="color: #000000;">&#40;</span>i<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>数组添加后的结果就是：<br />
0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15,16,16,17,17</p>
<p>现在我们已经得到一个拥有36个，18组的卡片信息了，现在要做的就是随机的从数组里抽取卡片了。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span>;xfor<span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span>;yvar <span style="color: #004993;">c</span><span style="color: #000000; font-weight: bold;">:</span>Card = <span style="color: #0033ff; font-weight: bold;">new</span> Card<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// copy the movie clip</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// stop on first frame</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">x</span> = <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">*</span>cardHorizontalSpacing<span style="color: #000000; font-weight: bold;">+</span>boardOffsetX; <span style="color: #009900;">// set position</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">y</span> = <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">*</span>cardVerticalSpacing<span style="color: #000000; font-weight: bold;">+</span>boardOffsetY;
 <span style="color: #6699cc; font-weight: bold;">var</span> r<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>cardlist.<span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// get a random face</span>
 <span style="color: #004993;">c</span>.cardface = cardlist<span style="color: #000000;">&#91;</span>r<span style="color: #000000;">&#93;</span>; <span style="color: #009900;">// assign face to card</span>
 cardlist.<span style="color: #004993;">splice</span><span style="color: #000000;">&#40;</span>r,<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// remove face from list</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">c</span>.cardface<span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
 <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">c</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// show the card</span>
 <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #6699cc; font-weight: bold;">var</span> r<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>cardlist.<span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>这段代码就是从数组列表里从0-元素个数之间得到一个随机数。即0-35.9999，因为元素的索引值是整数的，所以我们需要用到取整函数Math.floor，即向下取整，获得的最大值就是35了，如果想上取整的话，会发生错误的。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">cardlist.<span style="color: #004993;">splice</span><span style="color: #000000;">&#40;</span>r,<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// remove face from list</span></pre></div></div>

<p>就是将获得的索引的元素从数组里删去，不然的话，会发生重复调用的情况，因为已经使用过了，不需要了，删去。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #004993;">c</span>.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">c</span>.cardface<span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>因为c.carface获得的值为0-17，而我们的Card这个影片剪辑的关键帧是从1开始到19的，因为第一帧我们用做了背景。</p>
<p>测试下，我们会看到什么结果？</p>
<p><a href="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_5.jpg" class="highslide-image" onclick="return hs.expand(this);"><img class="alignnone size-full wp-image-31" title="05" src="http://www.minicg.com/blog/wp-content/uploads/2010/01/1_5.jpg" alt="" width="361" height="343" /></a></p>
<p>现在离我们的目标越来越近了。。</p>
<p>Game Play<br />
现在的游戏基本的思路已经弄好了，现在我们需要做的就是让用户点击卡片之后，去匹配我们的选择结果。我们需要一个记录卡片信息的值，这样我们才能知道第一次点击后第二次点击的卡片是否符合要求。</p>
<p>Adding Keyboard Listeners<br />
上面提到了用户点击的话，我们就需要添加鼠标点击相关的类文件了，还有事件侦听函数了。addEventListener，这个函数有两个参数为必须的，一个是侦听的事件类型，一个是回调函数<br />
我们现在需要的是：</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #004993;">c</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>,clickCard<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>我们需要添加另外一个事件类了</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">Import <span style="color: #004993;">flash.events</span>.<span style="color: #000000; font-weight: bold;">*</span>;</pre></div></div>

<p>回调函数为：</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> clickCard<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
 <span style="color: #6699cc; font-weight: bold;">var</span> thisCard<span style="color: #000000; font-weight: bold;">:</span>Card = <span style="color: #000000;">&#40;</span>event.<span style="color: #004993;">currentTarget</span> <span style="color: #0033ff; font-weight: bold;">as</span> Card<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// what card?</span>
 <span style="color: #004993;">trace</span><span style="color: #000000;">&#40;</span>thisCard.cardface<span style="color: #000000;">&#41;</span>;
 <span style="color: #000000;">&#125;</span></pre></div></div>

<p>在这个实例里，event参数是很关键的，因为我们要利用它来获取用户当前点击的卡片是36个图片中的哪一个。事件目标就是我们所获得的重要的信息，确切的说当前事件的目标。就这样，我们新建一个thisCard物件来指向我们所点击的卡片，我们可以从这个物件里获得cardface属性。我们可以利用trace来调试我们所获得的这些信息。MatchingGame4.as<br />
Setting Up Game Logic<br />
的开始设计游戏的逻辑了<br />
当用户点击了卡片后，我们需要确定到底属于游戏中的哪种情况，我们现在有3中情况需要处理：<br />
1.  开始没有卡片被选取的情况下，用户选择了第一张卡片。<br />
2.  已有一个卡片选取了，玩家选取第二个卡片，现在要处理的是所选取的这两个卡片是否匹配。<br />
3.  2个卡片选取了，但是并不匹配，需要做的是让这两个卡片恢复到初始状态。</p>
<p>为了方便记录我们所选的卡片记录，我们需要用定义两个变量。firstCard和secondCard。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">Private <span style="color: #6699cc; font-weight: bold;">var</span> firstCard;
Private <span style="color: #6699cc; font-weight: bold;">var</span> secondCard;</pre></div></div>

<p>虽然定义了两个变量，但是我们并没有给他附加任何具体的值。因为在稍后的操作里，我们会用这个null的值的变量去记录用户所选的卡片的具体状态。</p>
<p>好，回到先前的逻辑，不过用代买来解释了<br />
1. 开始没有卡片被选取的情况下，用户选择了第一张卡片。<br />
Firstcard<br />
2.已有一个卡片选取了，玩家没有选取第二个卡片。</p>
<p>具体代码：</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">public</span> <span style="color: #339966; font-weight: bold;">function</span> clickCard<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
 <span style="color: #6699cc; font-weight: bold;">var</span> thisCard<span style="color: #000000; font-weight: bold;">:</span>Card = <span style="color: #000000;">&#40;</span>event.<span style="color: #004993;">target</span> <span style="color: #0033ff; font-weight: bold;">as</span> Card<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// what card?</span>
 <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>firstCard == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900;">// first card in a pair</span>
 firstCard = thisCard; <span style="color: #009900;">// note it</span>
 firstCard.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>thisCard.cardface<span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// turn it over</span>
&nbsp;
<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>firstCard == thisCard<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900;">// clicked first card again</span>
 firstCard.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// turn back over</span>
 firstCard = <span style="color: #0033ff; font-weight: bold;">null</span>;
&nbsp;
<span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>secondCard == <span style="color: #0033ff; font-weight: bold;">null</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900;">// second card in a pair</span>
 secondCard = thisCard; <span style="color: #009900;">// note it</span>
 secondCard.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>thisCard.cardface<span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// turn it over</span>
&nbsp;
<span style="color: #009900;">// compare two cards</span>
 <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>firstCard.cardface == secondCard.cardface<span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span></pre></div></div>

<p>如果两个卡片匹配成功的话，我们需要移除这两个卡片同时重设fisrtcardhe secondcard这两个变量。虽然从显示列表里移除了，但是他们实际上仍然储存在变量里，所以我们需要把变量的值重设为null，这样才会从flash播放器里得到处理，真正的移除掉引用。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #009900;">// remove a match</span>
 <span style="color: #004993;">removeChild</span><span style="color: #000000;">&#40;</span>firstCard<span style="color: #000000;">&#41;</span>;
 <span style="color: #004993;">removeChild</span><span style="color: #000000;">&#40;</span>secondCard<span style="color: #000000;">&#41;</span>;
 <span style="color: #009900;">// reset selection</span>
 firstCard = <span style="color: #0033ff; font-weight: bold;">null</span>;
 secondCard = <span style="color: #0033ff; font-weight: bold;">null</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>当然如果不匹配的话，我们需要重设这两个卡片</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #000000;">&#125;</span> <span style="color: #0033ff; font-weight: bold;">else</span> <span style="color: #000000;">&#123;</span> <span style="color: #009900;">// starting to pick another pair</span>
 <span style="color: #009900;">// reset previous pair</span>
 firstCard.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>;
 secondCard.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span><span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>;
 secondCard = <span style="color: #0033ff; font-weight: bold;">null</span>;
 <span style="color: #009900;">// select first card in next pair</span>
 firstCard = thisCard;
 firstCard.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>thisCard.cardface<span style="color: #000000; font-weight: bold;">+</span><span style="color: #000000; font-weight:bold;">2</span><span style="color: #000000;">&#41;</span>;
 <span style="color: #000000;">&#125;</span>
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>在MatchingGame5.as</p>
<p>Checking for Game Over<br />
检查游戏的结束<br />
游戏结束的时候，需要在屏幕上出现相应的提示信息告诉玩家，你已完成游戏，所有的卡片都匹配完毕了。</p>
<p>解决的方法有：<br />
弄一个变量记录当前的卡片匹配个数，如果玩家每找到一组的话，就相应的加1，然后再检查这个变量是否与总数是否相等。</p>
<p>另一个方法就是检查卡片的个数，因为每匹配一组的话，就会从显示列表移除一组，总数是36个，当所有的都移除的话，显示列表的个数numchildren就为0了，也就是说游戏结束了。<br />
有这个方法的话，会发生的问题就是，如果当前的显示列表里有其他的显示元素，例如背景图片，标题等等的时候，显示的个数也会被算进去的。<br />
所以我们还是采用第一种方案<br />
新建变量</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #0033ff; font-weight: bold;">private</span> <span style="color: #6699cc; font-weight: bold;">var</span> cardsLeft<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>;
&nbsp;
cardsLeft = <span style="color: #000000; font-weight:bold;">0</span>;
 <span style="color: #0033ff; font-weight: bold;">for</span><span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span>;xfor<span style="color: #000000;">&#40;</span><span style="color: #6699cc; font-weight: bold;">var</span> <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span>=<span style="color: #000000; font-weight:bold;">0</span>;yvar <span style="color: #004993;">c</span><span style="color: #000000; font-weight: bold;">:</span>Card = <span style="color: #0033ff; font-weight: bold;">new</span> Card<span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// copy the movie clip</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// stop on first frame</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">x</span> = <span style="color: #004993;">x</span><span style="color: #000000; font-weight: bold;">*</span>cardHorizontalSpacing<span style="color: #000000; font-weight: bold;">+</span>boardOffsetX; <span style="color: #009900;">// set position</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">y</span> = <span style="color: #004993;">y</span><span style="color: #000000; font-weight: bold;">*</span>cardVerticalSpacing<span style="color: #000000; font-weight: bold;">+</span>boardOffsetY;
 <span style="color: #6699cc; font-weight: bold;">var</span> r<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">uint</span> = <span style="color: #004993;">Math</span>.<span style="color: #004993;">floor</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">Math</span>.<span style="color: #004993;">random</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span><span style="color: #000000; font-weight: bold;">*</span>cardlist.<span style="color: #004993;">length</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// get a random face</span>
 <span style="color: #004993;">c</span>.cardface = cardlist<span style="color: #000000;">&#91;</span>r<span style="color: #000000;">&#93;</span>; <span style="color: #009900;">// assign face to card</span>
 cardlist.<span style="color: #004993;">splice</span><span style="color: #000000;">&#40;</span>r,<span style="color: #000000; font-weight:bold;">1</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// remove face from list</span>
 <span style="color: #004993;">c</span>.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>,clickCard<span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// have it listen for clicks</span>
 <span style="color: #004993;">addChild</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">c</span><span style="color: #000000;">&#41;</span>; <span style="color: #009900;">// show the card</span>
 cardsLeft<span style="color: #000000; font-weight: bold;">++</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>在原来匹配的代码里添加</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">cardsLeft <span style="color: #000000; font-weight: bold;">-</span>= <span style="color: #000000; font-weight:bold;">2</span>;
 <span style="color: #0033ff; font-weight: bold;">if</span> <span style="color: #000000;">&#40;</span>cardsLeft == <span style="color: #000000; font-weight:bold;">0</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
 <span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>“gameover”<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>当剩余卡片数为0的时候，就跳转到gameover标签的关键帧<br />
此时，我们需要移除所有用代码创建的元素，但是，因为之前我们创建的36个卡片，因为我们每匹配一次就移除了一次，所有当匹配完所有的后，没有卡片剩余在屏幕上。所以我们可以直接跳转到gameover</p>
<p>在gameover这个关键帧里，我们可以放入简单的文字元件，或者其他的图形元件，当然你也可以放入动画等<br />
好了，接下来的工作就是在这个关键帧里加入一个重玩游戏的按键</p>
<p>Encapsulating the Game<br />
封装游戏<br />
现在我们可以正常运行我们的游戏了，当我们的flash影片运行是，游戏就初始化并开始了，影片就是游戏，游戏就是影片了</p>
<p>此时的游戏只是个简单的类型，但现实情况是我们需要游戏说明，游戏结束是的画面，加载画面等等。你甚至希望加入新的不同的内容用于不用的游戏版本。Flash是个很好的工具，swf其实就是一个影片剪辑，你可以在一个影片剪辑里嵌套一个影片剪辑，所以说一个游戏可以是一个影片剪辑，或者说一个游戏可以作为一个影片剪辑嵌套在另一个影片剪辑里。</p>
<p>为什么我们需要这样做呢？很简单，就是为了方便的更新新的内容，因此我们可以在第一帧作为游戏说明的界面，第二帧为游戏，第三帧为游戏结束画面。第二帧里的所拥有的影片，我们取名为MatchingGameObject7，我们将它捆包上MatchingGameObject7.as</p>
<p>Creating the Game Movie Clip<br />
在这个MatchingGameObject7.fla我们有3个关键帧，第二帧里只有一个简单的影片剪辑，它是一个空的影片剪辑，设置它和MatchingGameObject7.as类绑定，这样我们的游戏，实际上是由这个空的影片剪辑掌管了。<br />
这样我们就将游戏分为了游戏前和游戏后，而关键的游戏部分代码就在第二帧里的这个空影片剪辑所绑定的类文件。</p>
<p>Adding an Introduction Screen<br />
添加游戏介绍的界面<br />
我们不希望玩家一开始就直接玩游戏，他们也需要一些简单的游戏说明，在这个界面，我们要加入少量的AS，首先我们必须让游戏一开始运行的时候，就停止在这个关键帧上，然后加入几个按钮给用户选择。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">playButton.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>,startGame<span style="color: #000000;">&#41;</span>;
 <span style="color: #339966; font-weight: bold;">function</span> startGame<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
 <span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>“playgame”<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span>
 <span style="color: #004993;">stop</span><span style="color: #000000;">&#40;</span><span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>第二帧的标签名为playgame</p>
<p>第二帧里，需要放入之前我们绑定的空的影片剪辑，因为类文件名修改了，所以我们需要把之前的类文件重命名MatchingGameObject7.as。<br />
我们要修改一处的代码</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;"><span style="color: #004993;">MovieClip</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">root</span><span style="color: #000000;">&#41;</span>.<span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>“gameover”<span style="color: #000000;">&#41;</span>;</pre></div></div>

<p>之前直接可以gotoAndStop，因为现在和影片剪辑绑定了，而gameover是root里的标签，所以需要修改此处。</p>
<p>同时把属性面板绑定的文档类给删除掉。</p>
<p>Adding a Play Again Button<br />
添加重玩按钮<br />
在最后一帧，我们将要添加一个重玩按钮。</p>

<div class="wp_syntax"><div class="code"><pre class="actionscript3" style="font-family:Courier New,Lucida Console,Lucida Sans Unicode;">playAgainButton.<span style="color: #004993;">addEventListener</span><span style="color: #000000;">&#40;</span><span style="color: #004993;">MouseEvent</span>.<span style="color: #004993;">CLICK</span>,playAgain<span style="color: #000000;">&#41;</span>;
 <span style="color: #339966; font-weight: bold;">function</span> playAgain<span style="color: #000000;">&#40;</span>event<span style="color: #000000; font-weight: bold;">:</span><span style="color: #004993;">MouseEvent</span><span style="color: #000000;">&#41;</span> <span style="color: #000000;">&#123;</span>
 <span style="color: #004993;">gotoAndStop</span><span style="color: #000000;">&#40;</span>“playgame”<span style="color: #000000;">&#41;</span>;
<span style="color: #000000;">&#125;</span></pre></div></div>

<p>Adding Scoring and a Clock<br />
稍后补上，读者可以自己先弄弄 :cool:</p>
]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_26.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adobe不再提供Beta版的Flash Professional CS5</title>
		<link>http://www.minicg.com/blog/archives/post_11.html</link>
		<comments>http://www.minicg.com/blog/archives/post_11.html#comments</comments>
		<pubDate>Fri, 01 Jan 2010 11:09:23 +0000</pubDate>
		<dc:creator>WaveF</dc:creator>
				<category><![CDATA[相关资讯]]></category>
		<category><![CDATA[Beta]]></category>
		<category><![CDATA[CS5]]></category>
		<category><![CDATA[Flash]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/?p=11</guid>
		<description><![CDATA[有点后知后觉了，这是2009年12月17日官网发表的消息，不是传言，我到现在才留意到……
官方链接：《There will not be a beta for Flash Professional CS5》

对于等待了N久的测试者来讲肯定不是一个好消息，CS4的糟糕情况大家肯定记忆犹新，Flash CS5不开放公测就可能意味着更早到来的正式版、无尽的bug、更难适应各种用户的UI设计等等，当然我们还能祈求存在一个RC版什么的，那是后话了
到现时为止最稳定的套件版本是CS3 ，很多人都觉得Macromedia的东西被Adobe糟蹋了，我宁愿相信这只是一种暂时的情况，值得庆幸的是我们能够看到Adobe在接手Macromedia这些软件后从未停止过研发的步伐，希望终于有一天Adobe能为我们带来一套稳定、高效的创作套件。
]]></description>
			<content:encoded><![CDATA[<p>有点后知后觉了，这是2009年12月17日官网发表的消息，不是传言，我到现在才留意到……<br />
官方链接：<a href="http://blogs.adobe.com/flashplatform/2009/12/there_will_not_be_a_beta_for_f.html" target="_blank">《There will not be a beta for Flash Professional CS5》<br />
</a><br />
对于等待了N久的测试者来讲肯定不是一个好消息，CS4的糟糕情况大家肯定记忆犹新，Flash CS5不开放公测就可能意味着更早到来的正式版、无尽的bug、更难适应各种用户的UI设计等等，当然我们还能祈求存在一个RC版什么的，那是后话了</p>
<p>到现时为止最稳定的套件版本是CS3 ，很多人都觉得Macromedia的东西被Adobe糟蹋了，我宁愿相信这只是一种暂时的情况，值得庆幸的是我们能够看到Adobe在接手Macromedia这些软件后从未停止过研发的步伐，希望终于有一天Adobe能为我们带来一套稳定、高效的创作套件。</p>
]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_11.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>miniCG 2010</title>
		<link>http://www.minicg.com/blog/archives/post_1.html</link>
		<comments>http://www.minicg.com/blog/archives/post_1.html#comments</comments>
		<pubDate>Thu, 31 Dec 2009 16:00:53 +0000</pubDate>
		<dc:creator>WaveF</dc:creator>
				<category><![CDATA[相关资讯]]></category>
		<category><![CDATA[minicg]]></category>

		<guid isPermaLink="false">http://www.minicg.com/blog/?p=1</guid>
		<description><![CDATA[2010年是一个牛B的年份，miniCG注定要在这个牛B年份的第一天迎来自己的新生。
在新的一年里，miniCG将会由一只会写代码的熊猫和我来维护，主要会和大家进行一些程序和设计方面的交流，也算是提高自己能力的一种锻炼吧，这里会慢慢丰富起来的  
]]></description>
			<content:encoded><![CDATA[<p>2010年是一个牛B的年份，miniCG注定要在这个牛B年份的第一天迎来自己的新生。<br />
在新的一年里，miniCG将会由一只会写代码的熊猫和我来维护，主要会和大家进行一些程序和设计方面的交流，也算是提高自己能力的一种锻炼吧，这里会慢慢丰富起来的 <img src='http://www.minicg.com/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.minicg.com/blog/archives/post_1.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
