2

Sorry, I've never done AS before, so I apologize for the basic question. There is a line in this file I am trying to modify:

var media:Namespace = rssXML.channel.item[i].namespace("media");

I'm just trying to check to see if it exists and if it has a value?

I know in PHP it would be

if(isset(rssXML.channel.item[i].namespace("media") && !empty(rssXML.channel.item[i].namespace("media")) {

//Do Something

}

What would be the AS equivalent?

2 Answers2

2
if (variablename) { // it's there } else { // it's not }
SpliFF
  • 38,186
  • 16
  • 91
  • 120
0

All AS classes extend Object which has a hasOwnProperty() test which returns a boolean if a property with the name exists. Then you can test if (property) or if (property == null).

http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/Object.html#hasOwnProperty()

typeoneerror
  • 55,990
  • 32
  • 132
  • 223