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
Flash 使用AS3从XML/RSS文件读取属性_Flash_Actionscript 3 - Fatal编程技术网

Flash 使用AS3从XML/RSS文件读取属性

Flash 使用AS3从XML/RSS文件读取属性,flash,actionscript-3,Flash,Actionscript 3,非常简单的问题,我有一个问题:只有一部分完整的rss文件 <item> <title>Ok, de regalo de San Valentin me pueden dar un viaje a Playa del Carmen! Digo, entre todos lo pagan! No?? #So&#241;arNoCuestaNada</title> <link>http://twitter.com/gle

非常简单的问题,我有一个问题:只有一部分完整的rss文件

 <item>
      <title>Ok, de regalo de San Valentin me pueden dar un viaje a Playa del Carmen! Digo, entre todos lo pagan! No?? #So&#241;arNoCuestaNada</title>
      <link>http://twitter.com/glenyvalente/statuses/37202068301295616</link>
      <description>Ok, de regalo de San Valentin me pueden dar un viaje a &lt;b&gt;Playa&lt;/b&gt; del Carmen! Digo, entre todos lo pagan! No?? &lt;a href=&quot;http://search.twitter.com/search?q=%23So%C3%B1arNoCuestaNada&quot; onclick=&quot;pageTracker._setCustomVar(2, 'result_type', 'recent', 3);pageTracker._trackPageview('/intra/hashtag/#So&#241;arNoCuestaNada');&quot;&gt;#So&#241;arNoCuestaNada&lt;/a&gt;</description>
      <pubDate>Mon, 14 Feb 2011 17:30:38 +0000</pubDate>
      <guid>http://twitter.com/glenyvalente/statuses/37202068301295616</guid>
      <author>glenyvalente@twitter.com (Gleny Valente)</author>
      <media:content type="image/jpg" width="48" url="http://a1.twimg.com/profile_images/1225905511/S5030401_normal.JPG" height="48"/>
      <google:image_link>http://a1.twimg.com/profile_images/1225905511/S5030401_normal.JPG</google:image_link>
      <google:location>Venezuela</google:location>
      <twitter:metadata>
        <twitter:result_type>recent</twitter:result_type>
      </twitter:metadata>
    </item>
但是,tracerssXML.channel.item[item].media:content.attributes.url;始终为空,因此如何从标记中读取属性url???谢谢

好的,试试这个


请尝试rssXML.channel.item[item].namespacemedia::content@url

以下信息将帮助您找到与请求最接近的答案: 在“作为代码”部分中添加此导入:

private var media:Namespace = new Namespace("http://search.yahoo.com/mrss/");
然后,在功能块中,您可以通过以下方式访问媒体名称空间:

var urlString:String = rssXML.media::content.@url[0];
内容使用上面导入的媒体名称空间。现在您可以像访问内容一样访问成员。其中是成员url,它可以是一个索引数组——因此我们专门说@url[0]来获取第一个条目

如有疑问,可参考以下补充答案:

否,场景1,层“1”,第1帧,第19 1084行:语法错误:冒号前应为rightparen。再次否:场景1,层“1”,第1帧,第19 1084行:语法错误:冒号前应为rightparen。
var urlString:String = rssXML.media::content.@url[0];