﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>IT博客-这里的黄昏静悄悄-随笔分类-Action Script</title><link>http://www.cnitblog.com/jackrain/category/2514.html</link><description>I Like C++</description><language>zh-cn</language><lastBuildDate>Tue, 27 Sep 2011 23:39:02 GMT</lastBuildDate><pubDate>Tue, 27 Sep 2011 23:39:02 GMT</pubDate><ttl>60</ttl><item><title>Flash管理鼠标监听器[ActionScript]</title><link>http://www.cnitblog.com/jackrain/archive/2006/06/14/12263.html</link><dc:creator>这里的黄昏静悄悄</dc:creator><author>这里的黄昏静悄悄</author><pubDate>Wed, 14 Jun 2006 10:43:00 GMT</pubDate><guid>http://www.cnitblog.com/jackrain/archive/2006/06/14/12263.html</guid><wfw:comment>http://www.cnitblog.com/jackrain/comments/12263.html</wfw:comment><comments>http://www.cnitblog.com/jackrain/archive/2006/06/14/12263.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/jackrain/comments/commentRss/12263.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/jackrain/services/trackbacks/12263.html</trackback:ping><description><![CDATA[
		<pre class="alt2" style="BORDER-RIGHT: 1px inset; PADDING-RIGHT: 6px; BORDER-TOP: 1px inset; PADDING-LEFT: 6px; PADDING-BOTTOM: 6px; MARGIN: 0px; OVERFLOW: auto; BORDER-LEFT: 1px inset; WIDTH: 640px; PADDING-TOP: 6px; BORDER-BOTTOM: 1px inset; HEIGHT: 516px">
				<div dir="ltr" style="TEXT-ALIGN: left">
						<div class="actionscript">
								<span style="COLOR: #f000f0; FONT-STYLE: italic">/*----------------------------文档说明-------------------------
 *  Flash中常用一些自制的形状代替鼠标形状进行一些操作，比如模拟画笔
 *  用手的形状拖放、模拟颜料桶，这个时候如果不管理好鼠标监听器的注册
 *  卸载，以及鼠标的隐藏和显示的话会有很多意向不到的后果出现。
 *  这里写了一个监听器的注册管理函数，用来管理鼠标监听器的注册、卸载、显示
 *  和隐藏。
 *    首先定义了几个要用到的状态码，定义各种Object用于注册监听器，然后用
 *  RegMouse函数进行注册，该函数接收一个Number类型的参数，也就是要注册的监听器类型
 *  该函数首先卸载当前注册的监听器，然后注册新的监听器，如果当前监听器和要注册的新监听器一样的话
 *  就卸载当前监听器，并显示鼠标的默认状态。
 *    本例子主要是在制作一个Flash模拟Windows画图板的时候写的，下面是其中的部分代码。
 *----------------------------------------------------------------------*/</span>
 
<span style="COLOR: #f000f0; FONT-STYLE: italic">/*-------------- 鼠标状态定义------------
*                                       */</span><span style="COLOR: #993300">var</span> _cursorFlag:<span style="COLOR: #993300">Number</span> = <span style="COLOR: #000000">0</span>;<span style="COLOR: #f000f0; FONT-STYLE: italic">// 记录当前注册的鼠标监听器状态。</span><span style="COLOR: #993300">var</span> _cursorObj:<span style="COLOR: #993300">Object</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Object</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
_cursorObj.<span style="COLOR: #000000">def</span> = <span style="COLOR: #000000">0</span>;
_cursorObj.<span style="COLOR: #000000">drag</span> = <span style="COLOR: #000000">1</span>;
_cursorObj.<span style="COLOR: #000000">select</span> = <span style="COLOR: #000000">2</span>;
_cursorObj.<span style="COLOR: #000000">tong</span> = <span style="COLOR: #000000">3</span>;
_cursorObj.<span style="COLOR: #000000">pip</span> = <span style="COLOR: #000000">4</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">/*----------状态码---------------------
  *        0:默认状态，无任何形状,只能切换到其他状态后进行操作
  *        1:手的形状，可以从物品栏中拖物品
  *        2:选择状态，可以选择操作区中的东西
  *        3:油漆桶状态，可以涂色
  *        4:吸管状态，设置颜色
  *-------------------------------------
 *----------------------------------------*/</span><span style="COLOR: #f000f0; FONT-STYLE: italic">// 按钮事件定义</span><span style="COLOR: #f000f0; FONT-STYLE: italic">/*--------------- 用于控制菜单消失的鼠标监听器--------
 *     当菜单显示出来，并且在菜单之外的地方单击鼠标时，让菜单消失（主要是画图板工具栏上的菜单）*
 *--------------------------------------------------------------*/</span><span style="COLOR: #993300">var</span> _mmListen:<span style="COLOR: #993300">Object</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Object</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
_mmListen.<span style="COLOR: #993300">onMouseDown</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>!menu_mc.<span style="COLOR: #993300">hitTest</span><span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span>, <span style="COLOR: #993300">_ymouse</span><span style="COLOR: #000000">)</span><span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">addListener</span><span style="COLOR: #000000">(</span>drawObj<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">removeListener</span><span style="COLOR: #000000">(</span>_mmListen<span style="COLOR: #000000">)</span>;
        menu_mc.<span style="COLOR: #993300">gotoAndStop</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span>;
    <span style="COLOR: #000000">}</span><span style="COLOR: #000000">}</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">// 点击颜料桶时注册监听器</span><span style="COLOR: #993300">var</span> dmtong:<span style="COLOR: #993300">Object</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Object</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
dmtong.<span style="COLOR: #993300">onMouseMove</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    dmtong_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
    dmtong_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
<span style="COLOR: #000000">}</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">// 吸管工具</span><span style="COLOR: #993300">var</span> dmpip:<span style="COLOR: #993300">Object</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Object</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
dmpip.<span style="COLOR: #993300">onMouseMove</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    dmpip_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
    dmpip_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
<span style="COLOR: #000000">}</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">// 选择工具</span><span style="COLOR: #993300">var</span> dmselect:<span style="COLOR: #993300">Object</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Object</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
dmselect.<span style="COLOR: #993300">onMouseMove</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    dmcursor_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
    dmcursor_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
<span style="COLOR: #000000">}</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">// 画线工具</span>
line_mc.<span style="COLOR: #993300">clear</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
<span style="COLOR: #993300">var</span> drawObj:<span style="COLOR: #993300">Object</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Object</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
drawObj.<span style="COLOR: #000000">x1</span> = <span style="COLOR: #000000">0</span>;
drawObj.<span style="COLOR: #000000">y1</span> = <span style="COLOR: #000000">0</span>;
drawObj.<span style="COLOR: #000000">x2</span> = <span style="COLOR: #000000">0</span>;
drawObj.<span style="COLOR: #000000">y2</span> = <span style="COLOR: #000000">0</span>;
drawObj.<span style="COLOR: #000000">xx</span> = <span style="COLOR: #000000">0</span>;
drawObj.<span style="COLOR: #000000">yy</span> = <span style="COLOR: #000000">0</span>;
drawObj.<span style="COLOR: #000000">drawFlag</span> = <span style="COLOR: #993300">false</span>;
drawObj.<span style="COLOR: #000000">moveFlag</span> = <span style="COLOR: #993300">false</span>;
drawObj.<span style="COLOR: #000000">startFlag</span> = <span style="COLOR: #993300">false</span>;
drawObj.<span style="COLOR: #000000">moveMC</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Array</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
<span style="COLOR: #993300">var</span> plasterFlag:<span style="COLOR: #993300">Boolean</span> = <span style="COLOR: #993300">false</span>;
drawObj.<span style="COLOR: #993300">onMouseDown</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    <span style="COLOR: #f000f0; FONT-STYLE: italic">// 如果在操作区之外按下鼠标，则返回</span>
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span> &lt;= <span style="COLOR: #000000">68</span> || <span style="COLOR: #993300">_xmouse</span> &gt;= <span style="COLOR: #000000">400</span> || <span style="COLOR: #993300">_ymouse</span> &gt;= <span style="COLOR: #000000">260</span> || <span style="COLOR: #993300">_ymouse</span> &lt;= <span style="COLOR: #000000">55</span><span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        <span style="COLOR: #993300">return</span>;
    <span style="COLOR: #000000">}</span>
    <span style="COLOR: #f000f0; FONT-STYLE: italic">// 如果当前状态是不是移动选中的物品，则记录按下位置，用来画线</span>
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>drawObj.<span style="COLOR: #000000">moveFlag</span> != <span style="COLOR: #993300">true</span><span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        drawObj.<span style="COLOR: #000000">x1</span> = <span style="COLOR: #993300">_xmouse</span>;
        drawObj.<span style="COLOR: #000000">y1</span> = <span style="COLOR: #993300">_ymouse</span>;
        drawObj.<span style="COLOR: #000000">drawFlag</span> = <span style="COLOR: #993300">true</span>;
    <span style="COLOR: #000000">}</span>
    <span style="COLOR: #993300">else</span>
    <span style="COLOR: #000000">{</span>
        drawObj.<span style="COLOR: #000000">xx</span> = <span style="COLOR: #993300">_xmouse</span>;
        drawObj.<span style="COLOR: #000000">yy</span> = <span style="COLOR: #993300">_ymouse</span>;
        drawObj.<span style="COLOR: #000000">moveMC</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Array</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
        selectRect<span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
    <span style="COLOR: #000000">}</span>
    drawObj.<span style="COLOR: #000000">startFlag</span> = <span style="COLOR: #993300">true</span>;
<span style="COLOR: #000000">}</span>;
drawObj.<span style="COLOR: #993300">onMouseUp</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>drawObj.<span style="COLOR: #000000">moveFlag</span> != <span style="COLOR: #993300">true</span><span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        drawObj.<span style="COLOR: #000000">x2</span> = <span style="COLOR: #993300">_xmouse</span>;
        drawObj.<span style="COLOR: #000000">y2</span> = <span style="COLOR: #993300">_ymouse</span>;
        <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>drawObj.<span style="COLOR: #000000">x1</span> == <span style="COLOR: #993300">_xmouse</span> &amp;&amp; drawObj.<span style="COLOR: #000000">y1</span> == <span style="COLOR: #993300">_ymouse</span><span style="COLOR: #000000">)</span>
        <span style="COLOR: #000000">{</span>
            line_mc.<span style="COLOR: #993300">clear</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #000000">}</span>
        <span style="COLOR: #993300">else</span>
        <span style="COLOR: #000000">{</span>
            dmcursor_mc.<span style="COLOR: #993300">nextFrame</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #000000">}</span>
        drawObj.<span style="COLOR: #000000">drawFlag</span> = <span style="COLOR: #993300">false</span>;
    <span style="COLOR: #000000">}</span>
    drawObj.<span style="COLOR: #000000">startFlag</span> = <span style="COLOR: #993300">false</span>;
    <span style="COLOR: #993300">trace</span><span style="COLOR: #000000">(</span><span style="COLOR: #0000ff">"x1 = "</span> + drawObj.<span style="COLOR: #000000">x1</span><span style="COLOR: #000000">)</span>;
<span style="COLOR: #000000">}</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">// 单鼠标在选中区域内时，变成移动图标，否则变成选择图标。</span>
line_mc.<span style="COLOR: #993300">onEnterFrame</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>_cursorFlag == _cursorObj.<span style="COLOR: #000000">select</span> &amp;&amp; drawObj.<span style="COLOR: #000000">x1</span> != drawObj.<span style="COLOR: #000000">x2</span> &amp;&amp; drawObj.<span style="COLOR: #000000">y1</span> != drawObj.<span style="COLOR: #000000">y2</span> &amp;&amp; drawObj.<span style="COLOR: #000000">startFlag</span> == <span style="COLOR: #993300">false</span><span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">x1</span><span style="COLOR: #000000">)</span> * <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">x2</span><span style="COLOR: #000000">)</span> &lt; <span style="COLOR: #000000">0</span> &amp;&amp; <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">y1</span><span style="COLOR: #000000">)</span> * <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">y2</span><span style="COLOR: #000000">)</span> &lt; <span style="COLOR: #000000">0</span><span style="COLOR: #000000">)</span>
        <span style="COLOR: #000000">{</span>
            drawObj.<span style="COLOR: #000000">moveFlag</span> = <span style="COLOR: #993300">true</span>;
            drawObj.<span style="COLOR: #000000">drawFlag</span> = <span style="COLOR: #993300">false</span>;
            dmcursor_mc.<span style="COLOR: #993300">gotoAndStop</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">2</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #000000">}</span>
        <span style="COLOR: #993300">else</span>
        <span style="COLOR: #000000">{</span>
            drawObj.<span style="COLOR: #000000">moveFlag</span> = <span style="COLOR: #993300">false</span>;
            drawObj.<span style="COLOR: #000000">drawFlag</span> = <span style="COLOR: #993300">true</span>;
            dmcursor_mc.<span style="COLOR: #993300">gotoAndStop</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #000000">}</span>
    <span style="COLOR: #000000">}</span><span style="COLOR: #000000">}</span>;
drawObj.<span style="COLOR: #993300">onMouseMove</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    <span style="COLOR: #993300">trace</span><span style="COLOR: #000000">(</span>drawObj.<span style="COLOR: #000000">startFlag</span><span style="COLOR: #000000">)</span>;
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>_cursorFlag == _cursorObj.<span style="COLOR: #000000">select</span> &amp;&amp; drawObj.<span style="COLOR: #000000">startFlag</span> == <span style="COLOR: #993300">true</span><span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>drawObj.<span style="COLOR: #000000">moveFlag</span> == <span style="COLOR: #993300">true</span><span style="COLOR: #000000">)</span>
        <span style="COLOR: #000000">{</span>
            <span style="COLOR: #f000f0; FONT-STYLE: italic">// 移动</span>
            <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>drawObj.<span style="COLOR: #000000">x1</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">xx</span><span style="COLOR: #000000">)</span> &lt; <span style="COLOR: #000000">65</span> || drawObj.<span style="COLOR: #000000">x1</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">xx</span><span style="COLOR: #000000">)</span> &gt; <span style="COLOR: #000000">400</span> || drawObj.<span style="COLOR: #000000">x2</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">xx</span><span style="COLOR: #000000">)</span> &lt; <span style="COLOR: #000000">65</span> || drawObj.<span style="COLOR: #000000">x2</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">xx</span><span style="COLOR: #000000">)</span> &gt; <span style="COLOR: #000000">400</span> || drawObj.<span style="COLOR: #000000">y1</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">yy</span><span style="COLOR: #000000">)</span> &lt; <span style="COLOR: #000000">50</span> || drawObj.<span style="COLOR: #000000">y1</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">yy</span><span style="COLOR: #000000">)</span> &gt; <span style="COLOR: #000000">260</span> || drawObj.<span style="COLOR: #000000">y2</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">yy</span><span style="COLOR: #000000">)</span> &lt; <span style="COLOR: #000000">50</span> || drawObj.<span style="COLOR: #000000">y2</span> + <span style="COLOR: #000000">(</span><span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">yy</span><span style="COLOR: #000000">)</span> &gt; <span style="COLOR: #000000">260</span><span style="COLOR: #000000">)</span>
            <span style="COLOR: #000000">{</span>
                <span style="COLOR: #993300">return</span>;
            <span style="COLOR: #000000">}</span>
            <span style="COLOR: #993300">for</span><span style="COLOR: #000000">(</span><span style="COLOR: #993300">var</span> mm <span style="COLOR: #993300">in</span> drawObj.<span style="COLOR: #000000">moveMC</span><span style="COLOR: #000000">)</span>
            <span style="COLOR: #000000">{</span>
                drawObj.<span style="COLOR: #000000">moveMC</span><span style="COLOR: #000000">[</span>mm<span style="COLOR: #000000">]</span>.<span style="COLOR: #993300">_x</span> += <span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">xx</span>;
                drawObj.<span style="COLOR: #000000">moveMC</span><span style="COLOR: #000000">[</span>mm<span style="COLOR: #000000">]</span>.<span style="COLOR: #993300">_y</span> += <span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">yy</span>;
                drawObj.<span style="COLOR: #000000">moveMC</span><span style="COLOR: #000000">[</span>mm<span style="COLOR: #000000">]</span>.<span style="COLOR: #000000">x</span> = drawObj.<span style="COLOR: #000000">moveMC</span><span style="COLOR: #000000">[</span>mm<span style="COLOR: #000000">]</span>.<span style="COLOR: #993300">_x</span>;
                drawObj.<span style="COLOR: #000000">moveMC</span><span style="COLOR: #000000">[</span>mm<span style="COLOR: #000000">]</span>.<span style="COLOR: #000000">y</span> = drawObj.<span style="COLOR: #000000">moveMC</span><span style="COLOR: #000000">[</span>mm<span style="COLOR: #000000">]</span>.<span style="COLOR: #993300">_y</span>;
            <span style="COLOR: #000000">}</span>
            drawObj.<span style="COLOR: #000000">x1</span> += <span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">xx</span>;
            drawObj.<span style="COLOR: #000000">y1</span> += <span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">yy</span>;
            drawObj.<span style="COLOR: #000000">x2</span> += <span style="COLOR: #993300">_xmouse</span> - drawObj.<span style="COLOR: #000000">xx</span>;
            drawObj.<span style="COLOR: #000000">y2</span> += <span style="COLOR: #993300">_ymouse</span> - drawObj.<span style="COLOR: #000000">yy</span>;
            drawObj.<span style="COLOR: #000000">xx</span> = <span style="COLOR: #993300">_xmouse</span>;
            drawObj.<span style="COLOR: #000000">yy</span> = <span style="COLOR: #993300">_ymouse</span>;
        <span style="COLOR: #000000">}</span>
        <span style="COLOR: #993300">else</span>
        <span style="COLOR: #000000">{</span>
            drawObj.<span style="COLOR: #000000">x2</span> = <span style="COLOR: #993300">_xmouse</span>;
            drawObj.<span style="COLOR: #000000">y2</span> = <span style="COLOR: #993300">_ymouse</span>;
        <span style="COLOR: #000000">}</span>
        drawRect<span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
    <span style="COLOR: #000000">}</span>
    <span style="COLOR: #993300">else</span>
    <span style="COLOR: #000000">{</span>
    <span style="COLOR: #000000">}</span><span style="COLOR: #000000">}</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">// 手型图标</span><span style="COLOR: #993300">var</span> handObj:<span style="COLOR: #993300">Object</span> = <span style="COLOR: #993300">new</span><span style="COLOR: #993300">Object</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
handObj.<span style="COLOR: #993300">onMouseMove</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    hand_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
    hand_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
<span style="COLOR: #000000">}</span>;
hand_btn.<span style="COLOR: #993300">onRelease</span> = <span style="COLOR: #993300">function</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    RegMouse<span style="COLOR: #000000">(</span>_cursorObj.<span style="COLOR: #000000">drag</span><span style="COLOR: #000000">)</span>;
<span style="COLOR: #000000">}</span>;
<span style="COLOR: #f000f0; FONT-STYLE: italic">// 鼠标监听器注册管理函数</span><span style="COLOR: #993300">function</span> RegMouse<span style="COLOR: #000000">(</span>regID:<span style="COLOR: #993300">Number</span><span style="COLOR: #000000">)</span>:<span style="COLOR: #993300">Void</span><span style="COLOR: #000000">{</span>
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>regID &lt; <span style="COLOR: #000000">0</span> || regID &gt; <span style="COLOR: #000000">4</span><span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        <span style="COLOR: #993300">return</span>;
    <span style="COLOR: #000000">}</span>
    <span style="COLOR: #f000f0; FONT-STYLE: italic">// 清除上次的</span>
    <span style="COLOR: #993300">switch</span><span style="COLOR: #000000">(</span>_cursorFlag<span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">def</span> :
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">hide</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">drag</span> :
        hand_mc.<span style="COLOR: #993300">_x</span> = hand_mc.<span style="COLOR: #993300">_y</span> = -<span style="COLOR: #000000">500</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">removeListener</span><span style="COLOR: #000000">(</span>handObj<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">select</span> :
        dmcursor_mc.<span style="COLOR: #993300">_x</span> = dmcursor_mc.<span style="COLOR: #993300">_y</span> = -<span style="COLOR: #000000">500</span>;
        select_mc.<span style="COLOR: #993300">gotoAndStop</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span>;
        line_mc.<span style="COLOR: #993300">clear</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">removeListener</span><span style="COLOR: #000000">(</span>drawObj<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">removeListener</span><span style="COLOR: #000000">(</span>dmselect<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">tong</span> :
        dmtong_mc.<span style="COLOR: #993300">_x</span> = dmtong_mc.<span style="COLOR: #993300">_y</span> = -<span style="COLOR: #000000">500</span>;
        tong_mc.<span style="COLOR: #993300">gotoAndStop</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">removeListener</span><span style="COLOR: #000000">(</span>dmtong<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">pip</span> :
        dmpip_mc.<span style="COLOR: #993300">_x</span> = dmpip_mc.<span style="COLOR: #993300">_y</span> = -<span style="COLOR: #000000">500</span>;
        pip_mc.<span style="COLOR: #993300">gotoAndStop</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">1</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">removeListener</span><span style="COLOR: #000000">(</span>dmpip<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #000000">}</span>
    <span style="COLOR: #993300">if</span><span style="COLOR: #000000">(</span>_cursorFlag == regID<span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
        _cursorFlag = <span style="COLOR: #000000">0</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">show</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">return</span>;
    <span style="COLOR: #000000">}</span>
    <span style="COLOR: #f000f0; FONT-STYLE: italic">// 注册新的监听器</span>
    <span style="COLOR: #993300">switch</span><span style="COLOR: #000000">(</span>regID<span style="COLOR: #000000">)</span>
    <span style="COLOR: #000000">{</span>
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">def</span> :
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">show</span><span style="COLOR: #000000">(</span><span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">drag</span> :
        hand_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
        hand_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">addListener</span><span style="COLOR: #000000">(</span>handObj<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">select</span> :
        dmcursor_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
        dmcursor_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">addListener</span><span style="COLOR: #000000">(</span>drawObj<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">addListener</span><span style="COLOR: #000000">(</span>dmselect<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">tong</span> :
        dmtong_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
        dmtong_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">addListener</span><span style="COLOR: #000000">(</span>dmtong<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #993300">case</span> _cursorObj.<span style="COLOR: #000000">pip</span> :
        dmpip_mc.<span style="COLOR: #993300">_x</span> = <span style="COLOR: #993300">_xmouse</span>;
        dmpip_mc.<span style="COLOR: #993300">_y</span> = <span style="COLOR: #993300">_ymouse</span>;
        <span style="COLOR: #993300">Mouse</span>.<span style="COLOR: #993300">addListener</span><span style="COLOR: #000000">(</span>dmpip<span style="COLOR: #000000">)</span>;
        <span style="COLOR: #993300">break</span>;
    <span style="COLOR: #000000">}</span>
    _cursorFlag = regID;
<span style="COLOR: #000000">}</span></div>
				</div>
		</pre>
<img src ="http://www.cnitblog.com/jackrain/aggbug/12263.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/jackrain/" target="_blank">这里的黄昏静悄悄</a> 2006-06-14 18:43 <a href="http://www.cnitblog.com/jackrain/archive/2006/06/14/12263.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>遍历Tree组件的所有节点【ActionScript】</title><link>http://www.cnitblog.com/jackrain/archive/2006/05/29/11170.html</link><dc:creator>这里的黄昏静悄悄</dc:creator><author>这里的黄昏静悄悄</author><pubDate>Mon, 29 May 2006 01:42:00 GMT</pubDate><guid>http://www.cnitblog.com/jackrain/archive/2006/05/29/11170.html</guid><wfw:comment>http://www.cnitblog.com/jackrain/comments/11170.html</wfw:comment><comments>http://www.cnitblog.com/jackrain/archive/2006/05/29/11170.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/jackrain/comments/commentRss/11170.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/jackrain/services/trackbacks/11170.html</trackback:ping><description><![CDATA[
		<p> </p>
		<div style="BORDER-RIGHT: #cccccc 1px solid; PADDING-RIGHT: 5px; BORDER-TOP: #cccccc 1px solid; PADDING-LEFT: 4px; FONT-SIZE: 13px; PADDING-BOTTOM: 4px; BORDER-LEFT: #cccccc 1px solid; WIDTH: 98%; WORD-BREAK: break-all; PADDING-TOP: 4px; BORDER-BOTTOM: #cccccc 1px solid; BACKGROUND-COLOR: #eeeeee">
				<img id="Codehighlighter1_0_133_Open_Image" onclick="this.style.display='none'; Codehighlighter1_0_133_Open_Text.style.display='none'; Codehighlighter1_0_133_Closed_Image.style.display='inline'; Codehighlighter1_0_133_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" />
				<img id="Codehighlighter1_0_133_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_0_133_Closed_Text.style.display='none'; Codehighlighter1_0_133_Open_Image.style.display='inline'; Codehighlighter1_0_133_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" />
				<span id="Codehighlighter1_0_133_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">/**/</span>
				<span id="Codehighlighter1_0_133_Open_Text">
						<span style="COLOR: #008000">/*</span>
						<span style="COLOR: #008000">描述：用Flash做帮助内容，演示一个流程，所以选择Tree组件显示所有的步骤，在演示中，需要做到：按照swf播放的内容，自动调整Tree中被选中的node,同时要调整滚动条的位置（如果有的话），另外Tree中的所有节点是可以随时被点击的，点击后跳到相关位置<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" /></span>
						<span style="COLOR: #008000">*/</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />System.useCodepage </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">true</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #008000">//<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />//</span>
				<span style="COLOR: #008000"> XML相关变量定义</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">var</span>
				<span style="COLOR: #000000"> node_xml:XML </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">new</span>
				<span style="COLOR: #000000"> XML();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />node_xml.ignoreWhite </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">true</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">var</span>
				<span style="COLOR: #000000"> childNode:XMLNode;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> 定义消息监听对象</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #0000ff">var</span>
				<span style="COLOR: #000000"> evt_listen:Object </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">new</span>
				<span style="COLOR: #000000"> Object();<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />evt_listen.change </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">function</span>
				<span style="COLOR: #000000">(evt_obj:Object)<br /><img id="Codehighlighter1_355_446_Open_Image" onclick="this.style.display='none'; Codehighlighter1_355_446_Open_Text.style.display='none'; Codehighlighter1_355_446_Closed_Image.style.display='inline'; Codehighlighter1_355_446_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_355_446_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_355_446_Closed_Text.style.display='none'; Codehighlighter1_355_446_Open_Image.style.display='inline'; Codehighlighter1_355_446_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_355_446_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cnitblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_355_446_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    childNode </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> evt_obj.target.selectedItem;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    _root.gotoAndPlay(childNode.attributes.data);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> 定义XML文件载入处理函数</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">node_xml.onLoad </span>
				<span style="COLOR: #000000">=</span>
				<span style="COLOR: #000000"> </span>
				<span style="COLOR: #0000ff">function</span>
				<span style="COLOR: #000000">(success)<br /><img id="Codehighlighter1_502_855_Open_Image" onclick="this.style.display='none'; Codehighlighter1_502_855_Open_Text.style.display='none'; Codehighlighter1_502_855_Closed_Image.style.display='inline'; Codehighlighter1_502_855_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_502_855_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_502_855_Closed_Text.style.display='none'; Codehighlighter1_502_855_Open_Image.style.display='inline'; Codehighlighter1_502_855_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_502_855_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cnitblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_502_855_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (success)<br /><img id="Codehighlighter1_519_800_Open_Image" onclick="this.style.display='none'; Codehighlighter1_519_800_Open_Text.style.display='none'; Codehighlighter1_519_800_Closed_Image.style.display='inline'; Codehighlighter1_519_800_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_519_800_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_519_800_Closed_Text.style.display='none'; Codehighlighter1_519_800_Open_Image.style.display='inline'; Codehighlighter1_519_800_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_519_800_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cnitblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_519_800_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000"> 设置Tree组件和XML文件的关联</span>
								<span style="COLOR: #008000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000">        navigate_tree.dataProvider </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> node_xml;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000"> 设置Tree组件的外观</span>
								<span style="COLOR: #008000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000">        navigate_tree.setSize(</span>
								<span style="COLOR: #000000">170</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #000000">550</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000"> 显示水平滚动条</span>
								<span style="COLOR: #008000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000">        navigate_tree.hScrollPolicy </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">on</span>
								<span style="COLOR: #000000">"</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000"> 设置水平滚动条的最大值</span>
								<span style="COLOR: #008000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000">        navigate_tree.maxHPosition </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #000000">50</span>
								<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000"> 设置第一个节点</span>
								<span style="COLOR: #008000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000">        childNode </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> navigate_tree.getTreeNodeAt(</span>
								<span style="COLOR: #000000">0</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
						<span style="COLOR: #0000ff">else</span>
						<span style="COLOR: #000000">
								<br />
								<img id="Codehighlighter1_823_853_Open_Image" onclick="this.style.display='none'; Codehighlighter1_823_853_Open_Text.style.display='none'; Codehighlighter1_823_853_Closed_Image.style.display='inline'; Codehighlighter1_823_853_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_823_853_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_823_853_Closed_Text.style.display='none'; Codehighlighter1_823_853_Open_Image.style.display='inline'; Codehighlighter1_823_853_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
						<span id="Codehighlighter1_823_853_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cnitblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_823_853_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />           </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000"> 给出提示</span>
								<span style="COLOR: #008000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />
								</span>
								<span style="COLOR: #000000">         }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000"> 定义Tree组件节点的展开、选中函数</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />//</span>
				<span style="COLOR: #008000"> 函数名    ：    expandTree</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />//</span>
				<span style="COLOR: #008000"> 参数        ：    无</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />//</span>
				<span style="COLOR: #008000"> 返回值    ：    Void</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />//</span>
				<span style="COLOR: #008000"> 作用        ：    根据Flash播放的内容，选中树型控件中的节点，如果被选中节点含有子节点，则展开它，如果到了最后一个节点，则返回到第一个节点</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />//<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #0000ff">function</span>
				<span style="COLOR: #000000"> expandTree():Void<br /><img id="Codehighlighter1_1027_1904_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1027_1904_Open_Text.style.display='none'; Codehighlighter1_1027_1904_Closed_Image.style.display='inline'; Codehighlighter1_1027_1904_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockStart.gif" align="top" /><img id="Codehighlighter1_1027_1904_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1027_1904_Closed_Text.style.display='none'; Codehighlighter1_1027_1904_Open_Image.style.display='inline'; Codehighlighter1_1027_1904_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedBlock.gif" align="top" /></span>
				<span id="Codehighlighter1_1027_1904_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
						<img src="http://www.cnitblog.com/images/dot.gif" />
				</span>
				<span id="Codehighlighter1_1027_1904_Open_Text">
						<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 选中节点</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #000000">    navigate_tree.selectedNode </span>
						<span style="COLOR: #000000">=</span>
						<span style="COLOR: #000000"> childNode;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 设置水平滚动条的滚动位置</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #000000">    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000">(childNode.attributes.hPosition </span>
						<span style="COLOR: #000000">!=</span>
						<span style="COLOR: #000000"> undefined)<br /><img id="Codehighlighter1_1146_1217_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1146_1217_Open_Text.style.display='none'; Codehighlighter1_1146_1217_Closed_Image.style.display='inline'; Codehighlighter1_1146_1217_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1146_1217_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1146_1217_Closed_Text.style.display='none'; Codehighlighter1_1146_1217_Open_Image.style.display='inline'; Codehighlighter1_1146_1217_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_1146_1217_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cnitblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1146_1217_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        navigate_tree.hPosition </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> Number(childNode.attributes.hPosition);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #008000">//</span>
						<span style="COLOR: #008000"> 如果当前选中节点有子节点则展开它，并把下一个要选中的节点设置为当前节点的第一个子节点</span>
						<span style="COLOR: #008000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
						</span>
						<span style="COLOR: #000000">    </span>
						<span style="COLOR: #0000ff">if</span>
						<span style="COLOR: #000000"> (childNode.hasChildNodes())<br /><img id="Codehighlighter1_1299_1388_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1299_1388_Open_Text.style.display='none'; Codehighlighter1_1299_1388_Closed_Image.style.display='inline'; Codehighlighter1_1299_1388_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1299_1388_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1299_1388_Closed_Text.style.display='none'; Codehighlighter1_1299_1388_Open_Image.style.display='inline'; Codehighlighter1_1299_1388_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_1299_1388_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cnitblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1299_1388_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        navigate_tree.setIsOpen(childNode, </span>
								<span style="COLOR: #0000ff">true</span>
								<span style="COLOR: #000000">, </span>
								<span style="COLOR: #0000ff">true</span>
								<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        childNode </span>
								<span style="COLOR: #000000">=</span>
								<span style="COLOR: #000000"> childNode.firstChild;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />    </span>
						<span style="COLOR: #0000ff">else</span>
						<span style="COLOR: #000000">
								<br />
								<img id="Codehighlighter1_1397_1902_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1397_1902_Open_Text.style.display='none'; Codehighlighter1_1397_1902_Closed_Image.style.display='inline'; Codehighlighter1_1397_1902_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
								<img id="Codehighlighter1_1397_1902_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1397_1902_Closed_Text.style.display='none'; Codehighlighter1_1397_1902_Open_Image.style.display='inline'; Codehighlighter1_1397_1902_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />    </span>
						<span id="Codehighlighter1_1397_1902_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
								<img src="http://www.cnitblog.com/images/dot.gif" />
						</span>
						<span id="Codehighlighter1_1397_1902_Open_Text">
								<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #008000">//</span>
								<span style="COLOR: #008000"> 如果当前节点没有子节点，则设置下一个节点为同级节点中的下一个节点</span>
								<span style="COLOR: #008000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
								</span>
								<span style="COLOR: #000000">        </span>
								<span style="COLOR: #0000ff">if</span>
								<span style="COLOR: #000000"> (childNode.nextSibling </span>
								<span style="COLOR: #000000">!=</span>
								<span style="COLOR: #000000"> </span>
								<span style="COLOR: #0000ff">null</span>
								<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_1476_1518_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1476_1518_Open_Text.style.display='none'; Codehighlighter1_1476_1518_Closed_Image.style.display='inline'; Codehighlighter1_1476_1518_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1476_1518_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1476_1518_Closed_Text.style.display='none'; Codehighlighter1_1476_1518_Open_Image.style.display='inline'; Codehighlighter1_1476_1518_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_1476_1518_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cnitblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_1476_1518_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            childNode </span>
										<span style="COLOR: #000000">=</span>
										<span style="COLOR: #000000"> childNode.nextSibling;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />        </span>
								<span style="COLOR: #0000ff">else</span>
								<span style="COLOR: #000000">
										<br />
										<img id="Codehighlighter1_1529_1899_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1529_1899_Open_Text.style.display='none'; Codehighlighter1_1529_1899_Closed_Image.style.display='inline'; Codehighlighter1_1529_1899_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" />
										<img id="Codehighlighter1_1529_1899_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1529_1899_Closed_Text.style.display='none'; Codehighlighter1_1529_1899_Open_Image.style.display='inline'; Codehighlighter1_1529_1899_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />        </span>
								<span id="Codehighlighter1_1529_1899_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
										<img src="http://www.cnitblog.com/images/dot.gif" />
								</span>
								<span id="Codehighlighter1_1529_1899_Open_Text">
										<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #008000">//</span>
										<span style="COLOR: #008000"> 如果当前节点没有同级的下一个节点，则查找父级节点的下一个节点</span>
										<span style="COLOR: #008000">
												<br />
												<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
										</span>
										<span style="COLOR: #000000">            </span>
										<span style="COLOR: #0000ff">while</span>
										<span style="COLOR: #000000"> (childNode.parentNode </span>
										<span style="COLOR: #000000">!=</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">null</span>
										<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_1611_1757_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1611_1757_Open_Text.style.display='none'; Codehighlighter1_1611_1757_Closed_Image.style.display='inline'; Codehighlighter1_1611_1757_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1611_1757_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1611_1757_Closed_Text.style.display='none'; Codehighlighter1_1611_1757_Open_Image.style.display='inline'; Codehighlighter1_1611_1757_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_1611_1757_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cnitblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_1611_1757_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                childNode </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> childNode.parentNode;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                </span>
												<span style="COLOR: #0000ff">if</span>
												<span style="COLOR: #000000"> (childNode.nextSibling </span>
												<span style="COLOR: #000000">!=</span>
												<span style="COLOR: #000000"> </span>
												<span style="COLOR: #0000ff">null</span>
												<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_1694_1752_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1694_1752_Open_Text.style.display='none'; Codehighlighter1_1694_1752_Closed_Image.style.display='inline'; Codehighlighter1_1694_1752_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1694_1752_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1694_1752_Closed_Text.style.display='none'; Codehighlighter1_1694_1752_Open_Image.style.display='inline'; Codehighlighter1_1694_1752_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />                </span>
												<span id="Codehighlighter1_1694_1752_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
														<img src="http://www.cnitblog.com/images/dot.gif" />
												</span>
												<span id="Codehighlighter1_1694_1752_Open_Text">
														<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    childNode </span>
														<span style="COLOR: #000000">=</span>
														<span style="COLOR: #000000"> childNode.nextSibling;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                    </span>
														<span style="COLOR: #0000ff">break</span>
														<span style="COLOR: #000000">;<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />                }</span>
												</span>
												<span style="COLOR: #000000">
														<br />
														<img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />            </span>
										<span style="COLOR: #008000">//</span>
										<span style="COLOR: #008000"> 如果已经到整个节点树的最后一个节点，则把下一个节点设置为最开始的一个节点</span>
										<span style="COLOR: #008000">
												<br />
												<img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />
										</span>
										<span style="COLOR: #000000">            </span>
										<span style="COLOR: #0000ff">if</span>
										<span style="COLOR: #000000"> (childNode.parentNode </span>
										<span style="COLOR: #000000">==</span>
										<span style="COLOR: #000000"> </span>
										<span style="COLOR: #0000ff">null</span>
										<span style="COLOR: #000000">)<br /><img id="Codehighlighter1_1842_1895_Open_Image" onclick="this.style.display='none'; Codehighlighter1_1842_1895_Open_Text.style.display='none'; Codehighlighter1_1842_1895_Closed_Image.style.display='inline'; Codehighlighter1_1842_1895_Closed_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockStart.gif" align="top" /><img id="Codehighlighter1_1842_1895_Closed_Image" style="DISPLAY: none" onclick="this.style.display='none'; Codehighlighter1_1842_1895_Closed_Text.style.display='none'; Codehighlighter1_1842_1895_Open_Image.style.display='inline'; Codehighlighter1_1842_1895_Open_Text.style.display='inline';" src="http://www.cnitblog.com/images/OutliningIndicators/ContractedSubBlock.gif" align="top" />            </span>
										<span id="Codehighlighter1_1842_1895_Closed_Text" style="BORDER-RIGHT: #808080 1px solid; BORDER-TOP: #808080 1px solid; DISPLAY: none; BORDER-LEFT: #808080 1px solid; BORDER-BOTTOM: #808080 1px solid; BACKGROUND-COLOR: #ffffff">
												<img src="http://www.cnitblog.com/images/dot.gif" />
										</span>
										<span id="Codehighlighter1_1842_1895_Open_Text">
												<span style="COLOR: #000000">{<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/InBlock.gif" align="top" />                childNode </span>
												<span style="COLOR: #000000">=</span>
												<span style="COLOR: #000000"> navigate_tree.getTreeNodeAt(</span>
												<span style="COLOR: #000000">0</span>
												<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />            }</span>
										</span>
										<span style="COLOR: #000000">
												<br />
												<img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />        }</span>
								</span>
								<span style="COLOR: #000000">
										<br />
										<img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedSubBlockEnd.gif" align="top" />    }</span>
						</span>
						<span style="COLOR: #000000">
								<br />
								<img src="http://www.cnitblog.com/images/OutliningIndicators/ExpandedBlockEnd.gif" align="top" />}</span>
				</span>
				<span style="COLOR: #000000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">---------------------------------函数定义结束---------------------</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />//</span>
				<span style="COLOR: #008000"> 开始初始化</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
				<span style="COLOR: #000000">navigate_tree.addEventListener(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">change</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">, evt_listen);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />node_xml.load(</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">makeSWF.xml</span>
				<span style="COLOR: #000000">"</span>
				<span style="COLOR: #000000">);<br /><img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" /></span>
				<span style="COLOR: #008000">//</span>
				<span style="COLOR: #008000">---------------------------初始化结束-------------------</span>
				<span style="COLOR: #008000">
						<br />
						<img src="http://www.cnitblog.com/images/OutliningIndicators/None.gif" align="top" />
				</span>
		</div>
<img src ="http://www.cnitblog.com/jackrain/aggbug/11170.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/jackrain/" target="_blank">这里的黄昏静悄悄</a> 2006-05-29 09:42 <a href="http://www.cnitblog.com/jackrain/archive/2006/05/29/11170.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>对Array对象的错误认识[Action Script]</title><link>http://www.cnitblog.com/jackrain/archive/2006/04/20/9423.html</link><dc:creator>这里的黄昏静悄悄</dc:creator><author>这里的黄昏静悄悄</author><pubDate>Thu, 20 Apr 2006 11:47:00 GMT</pubDate><guid>http://www.cnitblog.com/jackrain/archive/2006/04/20/9423.html</guid><wfw:comment>http://www.cnitblog.com/jackrain/comments/9423.html</wfw:comment><comments>http://www.cnitblog.com/jackrain/archive/2006/04/20/9423.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cnitblog.com/jackrain/comments/commentRss/9423.html</wfw:commentRss><trackback:ping>http://www.cnitblog.com/jackrain/services/trackbacks/9423.html</trackback:ping><description><![CDATA[
		<p>      今天想写一个计算24点的class,里面用到了Array，虽然在此之前用到过很多次，但是一些细节却没有在意过，所以今天调试时遇到的很多情况都出乎意料之外，在此写出。</p>
		<p>1、<font style="BACKGROUND-COLOR: #ff9900">new Array( )</font></p>
		<p>之前用它只用过两种</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">var test_array:Array = new Array(inital_len); // 创建一个长度为inital_len的空数组</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">var test_array:Array = new Array(1, 2, 3); // 创建一个长度为3的数组，并且其元素为1，2，3</font>
		</p>
		<p>今天突发奇想，能不能用另一个数组创建新数组呢，比如下面的</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">var source_array:Array = new Array(1, 2, 3);</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">var test_array:Array = new Array(source_array);</font>
		</p>
		<p>我想要得到的效果是test_array跟source_array一样，都有包含“1、2、3”3个元素。trace了一下，的确输出了1、2、3，但是如果执行</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">trace(test_array.length);</font>
		</p>
		<p>output却是1。现在知道了吧，new Array只是把soure_array作为一个元素构造了test_array而已。</p>
		<p>2、用一个数组给另一个数组赋值</p>
		<p>既然不能用var test_array:Array = new Array(source_array);的方式由一个数组构造另一个数组，那么我用"="可以吧！比如：</p>
		<p>
				<span class="Code">
				</span>
		</p>
		<p>这个效果如何呢，trace了test_array的长度和内容都是预料之中的，看来的确成功了。</p>
		<p>然后是不是可以随便操作test_array呢。比如</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">var source_array:Array = new Array(1, 2, 3);</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">var test_array:Array = source_array;</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">test_array.splice(0, 1);</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">trace("source_array = " + source_array);</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">trace("test_array   = " + test_array);</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ffffff">你猜结果是什么？</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">source_array = 2, 3</font>
		</p>
		<p>
				<font style="BACKGROUND-COLOR: #ff9900">test_array    = 2, 3</font>
		</p>
		<p>Why?</p>
		<p>我只是想改变test_array的内容，为什么source_array也改变了？难道test_array和source_array指向同一块内存？用赋值操作符时是引用而不是拷贝？查看了一下帮助手册，还真是如此！</p>
		<p>唉，以后真的要仔细看看说明才行！</p>
<img src ="http://www.cnitblog.com/jackrain/aggbug/9423.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cnitblog.com/jackrain/" target="_blank">这里的黄昏静悄悄</a> 2006-04-20 19:47 <a href="http://www.cnitblog.com/jackrain/archive/2006/04/20/9423.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>