Help with replacing "Undefined" text when there is no XML data

Hi Guys,

Not sure if anyone could help, i’m a bit of a novice at actionscript and would appreciate some help.

A client has asked me to update the create for a flash widget, they have a problem with the widget displaying “Undefined” where there is no data being pulled in from the XML.

What they have asked me to do is write a bit of actionscript to display “Sorry, there is no offers at the moment” instead of it dipslaying “Undefined”.

I’m guessing it may go into the onLoad function? (see code below)

Your help would be much appreciated!

Cheers,
Oz

**
ActionScript used to load XML:**

//XML Class to process XML
import spinnaker.core.xml.XMLExt

var offer_array:Array; //holding Array
var current_offer:Object = new Object();
//Loads XML
var viking_xml:XML = new XML();
viking_xml.ignoreWhite = true;
viking_xml.onLoad = function(success:Boolean) {
trace("success: "+success);
if(success) {
offer_array = processXML(viking_xml.firstChild);
current_offer = getOffer(offer_array, 1, 19)

    for(var prop in current_offer){
        trace("current_offer." + prop + "=" +current_offer[prop]);
        
    }
    
    
    gotoAndStop(2);
}

};
viking_xml.load(“viking.xml”); //URL update here

ActionScript Used to populate text fields:

function addOffer():Void{

trace(current_offer.date);

//Adds copy
header_txt.text = current_offer.header;
price_txt.text  = current_offer.price;
body_txt.text   = current_offer.body;
date_txt.text   = current_offer.date;


//Sets button
delete btn.onRelease;
trace(current_offer.link)
btn.onRelease = function():Void{
    getURL(current_offer.link, "_blank");
}

offer_image.swapDepths(image_mc);
offer_image.removeMovieClip();
offer_image = addImage(current_offer.image);

trace(current_offer.section)
//Sets candle to correct point
for(var i:Number = 0; i < candle_array.length; i++){
    if(i+1 == current_offer.section)
        candle_array*._visible = true;
    else
        candle_array*._visible = false;
        
    trace(candle_array* + ":" + candle_array*._visible);
}

}