Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Xml 获取光标所在的节点_Xml_Actionscript 3_Actionscript - Fatal编程技术网

Xml 获取光标所在的节点

Xml 获取光标所在的节点,xml,actionscript-3,actionscript,Xml,Actionscript 3,Actionscript,我在一个文本区域中显示XML数据,我想得到光标所在的节点 是否有一种方法或方法可以用于根据光标位置获取绝对位置 以下是基本的XML: <root> <branch> <leaf/> <leaf/> <leaf name="Carol"/> </branch> <branch> <leaf/> <leaf/>

我在一个文本区域中显示XML数据,我想得到光标所在的节点

是否有一种方法或方法可以用于根据光标位置获取绝对位置

以下是基本的XML:

<root> 
  <branch>
      <leaf/>
      <leaf/>
      <leaf name="Carol"/>
  </branch>
  <branch>
      <leaf/>
      <leaf/>
      <branch>
          <leaf name="Bill"/>
          <leaf/>
      </branch>
  </branch>
</root>


因此,如果在名为“Bill”的节点中有光标,我希望它返回一个[1,2,0]。因此,这些值是每个嵌套级别的子节点的索引。因此,如果光标位于名为“Bill”的叶节点中,则该值将为[1,2,0],即第二项、第三项、第一项。如果这有道理的话

您可以使用
getLineIndexAtPoint
ot,读取它的内容,然后在xml中搜索它以获得“数组”索引