views:

109

answers:

3

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?

A: 
if (variablename) { // it's there } else { // it's not }
SpliFF
A: 

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