- 浏览: 43284 次
- 性别:
- 来自: 深圳
最新评论
as3终于给了xml一个名分,使他成了真正的内置数据类型,
现在我们不必像以前一样,把xml转成数组或者object了,直接可以操作xml了
以下copy自as3 cookbook 第20章
[1b]写xml操作:[/1b]
var example:XML = ehbeesee;
[1b]用变量写:[/1b]
// Assume two variables exist, username and score
var username:String = "Darron";
var score:int = 1000;
// Use curly braces around the variable name to use its value when
// assigning XML via an XML literal
var example:XML =
{username}
{score}
;
[1b]字符串:[/1b]
// Create the XML structure with a string so use the value of both
// username and score inside of the XML packet.
var str:String = "" + username + ""
+ "" + score + "";
// Pass the string to the constructor to create an XML object
var example:XML = new XML( str );
[1b]填加元素[/1b]
// Create an XML instance to add elements to
var example:XML = ;
// Create a new XML node named newElement and add it to the
// example instance
example.newElement = ;
/* Displays:
*/
trace( example );
[1b]技巧:[/1b]
// Create an XML instance to work with
var example:XML = ;
var id:int = 10;
// Create a string to incorporate the value of id in the node name
example[ "user" + id ] = "";
/* Displays:
*/
trace( example );
[1b]“-” 会引起编译器错误,用数组操作符避免这个[/1b]
example.some-element = ""; // Generates a compiler error
example[ "some-element" ] = "";
[1b]insertChildBefore 和 insertChildAfter 作用[/1b]
// Create an XML instance to work with
var example:XML = ;
// Create an empty two element node
example.two = "";
// Before the two element node, add a one element node
example = example.insertChildBefore( example.two, );
// After the two element node, add a three element node
example = example.insertChildAfter( example.two, );
/* Displays:
*/
trace( example );
[1b]填加 文本节点 到xmlobject:[/1b]
// Create an XML instance to work with
var example:XML = ;
// Create a text node from a string
example.firstname = "Darron";
// Create a text node from a number
example.number = 24.9;
// Create a text node from a boolean
example.boolean = true;
// Create a text node from an array
example.abc = ["a", undefined, "b", "c", null, 7, false];
/* Displays:
Darron
24.9
true
a,,b,c,,7,false
*/
trace( example );
[1b]appendChild( ), prependChild( ), insertChildBefore( ), or insertChildAfter( ). 方法:[/1b]
// Create an XML instance to work with
var example:XML = ;
// Append a two element node containing a text node child
// with value 2
example.appendChild( 2 );
// Prepend a one element node containing a text node child
// with value "number 1"
example.prependChild( "number 1" );
// After the one element node, insert a text node with
// value 1.5
example.insertChildAfter( example.one[0], 1.5 );
// Before the two element node, insert a part element node
// containing a text node child with value 1.75
example.insertChildBefore( example.two[0], 1.75 );
/* Displays:
"number 1"
本文转自:http://www.5uflash.com/flashjiaocheng/Flash-as3-jiaocheng/407.html
发表评论
-
Flash打造美女影片指导进度条
2010-04-10 13:44 653我们制作一个好看的影片导入进度条。 先看效果。 准 ... -
详谈flash Loading教程
2010-04-10 13:43 595[1b]Loading的制作[/1b] ... -
简单的flash播放进度控制条
2010-04-10 13:43 542实际运用时,将下列源文件中的Control_progress ... -
Flash基础理论课:制作Loading思路详解(附图)
2010-04-10 13:43 598[1b] [/1b] [1b]思路:[/1b] 1、制作一个1 ... -
即拷即用的loading代码
2010-04-10 13:43 523// 设置loading的宽、高、颜色 var loadin ... -
用实验中的Actionscript 3.0实现颜色拾取
2010-04-09 14:07 772var linkageId = "Bliss.jp ... -
e4x - 对xml操作的一些示例
2010-04-09 14:07 538as3终于给了xml一个名分,使他成了真正的内置数据类型, 现 ... -
as3游戏开发之打气球系列(二)
2010-04-09 14:06 482HI,经过了昨天疯狂的理 ... -
我对as3声音架构的理解
2010-04-09 14:06 594一直都对as3的声音架构 ... -
flash as3做几何画板-先写一个按钮类
2010-04-09 11:58 898package draw1 { import ... -
flash as3做几何画板-数据格式
2010-04-09 11:58 787id m_type m_x1 m_y1 m_point1 m ... -
flash as3做几何画板-数据格式
2010-04-09 11:57 634id m_type m_x1 m_y1 m_point1 m ... -
flash as3做几何画板-点
2010-04-09 11:57 932任何情况下: 鼠标在点上移动:点变成橙色 鼠标离开点:还原原来 ... -
flash as3做几何画板-点
2010-04-09 11:57 707任何情况下: 鼠标在点上移动:点变成橙色 鼠标离开点:还原原来 ... -
flash8水波制作简明实例
2010-04-08 11:30 761一直一来,flash8的水波制作都是比较让我向往的,网上也出了 ... -
flash8水波制作简明实例
2010-04-08 11:30 646一直一来,flash8的水波制作都是比较让我向往的,网上也出了 ... -
flash神秘星空的制作过程
2010-04-08 11:30 616这是我前些时候学的 ... -
flash神秘星空的制作过程
2010-04-08 11:30 716这是我前些时候学的 ... -
在Flash8中用Blendmode打造光影变换
2010-04-08 11:29 563[1b]演示文件[/1b]: [1b] ... -
Flash绘制美丽风景画之海滩
2010-04-08 09:45 578过前段时间学习,我们掌握了鼠绘的一些初步知识,今天我们来综合一 ...
相关推荐
对远程操作系统识别功能进行了加强,并去掉了一些可由脚本完成的插件。 感谢isno和Enfis提供优秀插件,感谢悟休、quack帮忙精选nasl脚本列表,也感谢其他提供优秀思路和协助测试的朋友。 X-Scan v2.3 -- 发布日期...
X-Scan v1.0(beta) -- 发布日期:07/12/2001,新增对远程操作系统类型及版本识别功能;新增对 远程主机地理位置查询功能;在“-iis”选项中,新增对IIS “.ida/.idq”漏洞的扫描,同时更新漏洞 描述;在“-port”...
E4X WMLScript 服务器脚本 SQL ASP ADO PHP .NET(dotnet) .NET Microsoft .NET ASP .NET Mobile 多媒体 Media SMIL SVG 建站手册 网站构建 万维网联盟 (W3C) 浏览器信息 网站品质 语义网 职业规划 ...
JSONPath从E4X借用此语法 * 通配符。 所有对象/元素,无论其名称如何。 [] 下标运算符。 XPath使用它来遍历元素集合和谓词。 在Javascript和JSON中,它是本机数组运算符。 [,] XPath中的Union运算符导致节点...
● 使用Ajax、E4X/XML和JSON推动Web 2.0应用 ● 执行数据输入验证和提高安全性 配书光盘 配书光盘的精彩内容如下: ● 29个附赠章节,这些章节讨论了数据输入验证、脚本 调试和跨浏览器动态HTML等高级主题。 ● 可供...
《javascript宝典(第7版)》内容简介:您想创建更具魅力的交互网页吗?您想更好地控制浏览器呈现内容的方式吗?经典畅销书们avascript宝典(第7版...使用ajax、e4x/xml利json推动web2.0应用 执行数据输入验证和提高安全性
本节为必须对关键业务程序重新启用 HTML 帮助 ActiveX 控件的管理员提供了一些示例。这些替代方法可能会危及计算机,使之更容易遭受上述安全更新所克制的威胁。最安全的做法是不要使用注册表替代方法。如果必须使用...
3.6.9E4X操作符 49 3.7条件语句 50 3.7.1if…else语句 50 3.7.2switch语句 53 3.8循环语句 55 3.8.1while语句 55 3.8.2do…while语句 56 3.8.3for语句 56 3.8.4for…in语句 57 3.8.5foreach…in语句 58 3.8.6break与...
对象路径 用于半结构化数据的敏捷NoSQL查询语言 #Python #NoSQL #Javascript #JSON#... 它借鉴了E4X,JSONPath,XPath和SQL的优点。 ObjectPath是JSON文档,XPath是XML。 说明这种关系的其他示例是: 范围 语 文字
原创 Eaglet.dll 为图片上传组件 Eaglet.xml 为注释文件 本组件支持MVC,使用方法:右键MVC项目的“引用”——添加引用——浏览——找到并添加eaglet.dll 使用方法见示例程序MvcWebControlsTest