Celeste :: 深蓝世纪 :: 技术专区

Welcome to Celesteteam CeTech!

« SEO的机会无处不在 AS3中的类定义 更多选项 »

XML: @ Operator for Attributes

E4X (XML used in ActionScript 3) has new operators to access values in XML. One operator is the @ operator which accesses attributes. It can be used in place of the attribute() (Top level XML.attribute()) method for obtaining attribute values. Ex:

var myXML:XML = <user name="senocular" id="2867" />;
trace(myXML.attribute("name")); // senocular
trace(myXML.attribute("id")); // 2867
trace(myXML.@name); // senocular
trace(myXML.@id); // 2867 


You can also use an asterisk (*) with the @ operator to get a list of all attributes associated with an XML node in the form of an XMLList object. This is equivalent to the attributes() (Top level XML.attributes()) method. Ex:

var myXML:XML = <user name="senocular" id="2867" />;
var atts:XMLList;

atts = myXML.attributes();
trace(atts.toXMLString());
/* Output:
senocular
2867
*/
atts = myXML.@*;
trace(atts.toXMLString());
/* Output:
senocular
2867
*/


原文:
http://www.kirupa.com/forum/showthread.php?s=923b583d23915c7b446c1ecf09d5fa2b&p=1914704#post1914704

另外,这个网上还一个长长的列表介绍AS3的功能,很是详细,可以去看看,上面是其中的一篇。
网址:http://www.kirupa.com/forum/showthread.php?t=223798

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

日历

最新留言

最近发表

Powered By Z-Blog 1.6 Final Build 60816

关于我们 | 服务项目 | 客户案例 | 联系我们 :: Copyright @ Celesteteam.com