开发者

e4x newb woes - attribute trace

Sorry if I'm doing anything really dumb, but could anybody see anything immediately wrong with the following?

var layout = new XML()

layout=
<layout color="red">
</layout>

function init()
{ 
post(layout.@color);
}

it returns what I assume to be a ram address rat开发者_高级运维her than the value.

In the event that the software in question wants an object of type string, what is the best way to enforce that? I doubt thats the cas, but am willing to try


A string cast should work fine, e.g.:

trace(String(layout.@color));

Note that in your example there's no need to assign a new XML object to layout, since you overwrite it with the next assignment one line later.

This article is highly useful if you're just getting started with E4X.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜