as3 xml 判断是否包含属性


as3 xml 判断是否包含属性
2011年07月14日
  网易博客安全提醒:系统检测到您当前密码的安全性较低,为了您的账号安全,建议您适时修改密码    立即修改  |  关闭
  var xl:XML =  
  http://adobe.com  
  http://l4cd.net  
  http://google.com  
  http://qq.com  
    继续使用xl.item.(@type == 1),将出现以下错误
  ReferenceError: Error #1065: 变量 @type 未定义。 
  为避免这种情况..可以使用hasOwnProperty方法..先判断是否有指定的属性~ 
  trace(xl.item.(hasOwnProperty('@type') && @type == 1));  
  
  

猜你喜欢

转载自ybhy40ybhy.iteye.com/blog/1359608
今日推荐