# Flash Menu

**URL:** <https://forum.kirupa.com/t/flash-menu/258377>\
**Category:** Uncategorized\
**Created:** [April 23, 2008, 2:58pm UTC](https://forum.kirupa.com/t/flash-menu/258377 "2008-04-23T14:58:52Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![imagined](https://avatars.discourse-cdn.com/v4/letter/i/a87d85/32.png) [@imagined](https://forum.kirupa.com/u/imagined)\
**Post date:** [April 23, 2008, 2:58pm UTC](https://forum.kirupa.com/t/flash-menu/258377/1 "2008-04-23T14:58:52Z")

</div>

I haven’t done anything in Flash for a while, I focused on PHP. But a customer wants some animation in Flash. So I’m creating a Flash menu on CS3 for the first time and I find out that it’s not as it used to be. So I look for a tutorial online on how to work with buttons. It tells me to name the button and do some programming to it:

```auto

homepage.addEventListener(MouseEvent.CLICK,goWhere)
function goWhere(evt)
{
	var url = "http://www.mydomain.com"
	navigateToURL(new URLRequest(url))
}

```

But now I want to create a lot of buttons since it’s a menu and I can’t use this custom function because it only works with ONE url. For a quick fix, I create a function per page, for example:

```auto

homepage.addEventListener(MouseEvent.CLICK,goWhere)
function goWhere(evt)
{
	var url = "http://www.mydomain.com"
	navigateToURL(new URLRequest(url))
}

page2.addEventListener(MouseEvent.CLICK,goWherePage2)
function goWhereHTT(evt)
{
	var url = "http://www.mydomain.com/page2.php"
	navigateToURL(new URLRequest(url))
}

page3.addEventListener(MouseEvent.CLICK,goWherePage3)
function goWhereProjects(evt)
{
	var url = "http://www.mydomain.com/page3.php"
	navigateToURL(new URLRequest(url))
}

```

I know there should be a way to make an if statement and simplify the code. This would be very useful since there is more than 3 pages.

Problem #2, the URL comes out in a new window, how can I make it come out in the same window?

Sorry, I do not know ActionScript, I just kinda figure out what the code means.
