# Help w/ button action script

**URL:** <https://forum.kirupa.com/t/help-w-button-action-script/241514>\
**Category:** Uncategorized\
**Created:** [October 15, 2007, 6:08am UTC](https://forum.kirupa.com/t/help-w-button-action-script/241514 "2007-10-15T06:08:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![celticvfx](https://avatars.discourse-cdn.com/v4/letter/c/7ba0ec/32.png) [@celticvfx](https://forum.kirupa.com/u/celticvfx)\
**Post date:** [October 15, 2007, 6:08am UTC](https://forum.kirupa.com/t/help-w-button-action-script/241514/1 "2007-10-15T06:08:44Z")

</div>

hello

I have two buttons that getURL either to a PDF or link to a website, and the PDF path and link path are dynamic based on an XML file.

in some cases there isnt a PDF or link so I need to display an message. I thought this code would work but its always displaying the message, even when it has a success (has an assigned value). Also, after I push the button once, button looses its assignment to the variable, (Im checking via trace), and then is always coming up ‘undefined’

here is some code:

function DisplayInfo(){  
scrollField.initScroll();  
PressScroller.scroll\_content.scrollField.text = this.bodytxt;  
PressScroller.scroll\_content.scrollField.autoSize=true;

```
var assignPDF = this._parent.assignPDF;
var assignLink = this._parent.assignLink;

btn_PDF.onRelease = function () {
	if (assignPDF = "undefined") {
		PressUndefined.gotoAndPlay(1); //this displays 'no data' message
		DisplayInfo;
	} else {
		getURL(assignPDF,_blank);
	}
}

btn_Link.onRelease = function () {
	if (assignLink = "undefined") {
		PressUndefined.gotoAndPlay(1);
		DisplayInfo;
	} else {
		getURL (assignLink,_blank);
	}
		
}

```

}

the release calls work when I remove the if/then statement from the code, it just gives an error when there isnt any data in the XML file.

TIA  
celticvfx
