# EventListener troubles - how to pass string to function?

**URL:** https://forum.kirupa.com/t/eventlistener-troubles-how-to-pass-string-to-function/241317
**Category:** Uncategorized
**Created:** [October 12, 2007, 4:48am UTC](https://forum.kirupa.com/t/eventlistener-troubles-how-to-pass-string-to-function/241317 "2007-10-12T04:48:46Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mindfriction](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/mindfriction/32/172_2.png) [@mindfriction](https://forum.kirupa.com/u/mindfriction)
#### Post date: [October 12, 2007, 4:48am UTC](https://forum.kirupa.com/t/eventlistener-troubles-how-to-pass-string-to-function/241317/1 "2007-10-12T04:48:46Z")

</div>

Hey guys, been cruising the forums and google about this, still confused. I have a series of buttons, which on mouse press need to pass a string to a function. i just dont understand how to do this easily with event listeners

```auto

function showLocations(event:MouseEvent):void {
	var state = arguments.caller.state;
	var w = 640;
	var h = 480;
	var jscommand:String = "if (!win || win.closed) { var win = window.open('http://dev.calendarxpress.com.au/locations.php?state="+state+"','Locations','height=480,width=640,toolbar=no,scrollbars=yes,resizable=yes,top='+((screen.height/2)-("+h+"/2))+',left='+((screen.width/2)-("+w+"/2)));} else { win.focus();}";
	var url:URLRequest = new URLRequest("javascript:" + jscommand + " void(0);");
	url.method = URLRequestMethod.GET;
	//url.data = vars;
	
	try {
		navigateToURL(url, "_self");
		status_txt.text = "Opening window...";
	} catch (e:Error) {
		status_txt.text = "Error";
	}
	
}

vic_btn.addEventListener(MouseEvent.CLICK, showLocations);
vic.btn.state = 'vic';

```
