Getting navigation to work properly

Hi there,

I had an idea for a navigation menu where I could press down a button and it would stay in its ‘down’ state. In addition it could be navigated by using the keypad and those buttons are used to call up xml images. Getting this to work has been more of a headache/challenge than I imagined.

I’m fairly close, the code I have was suggested to me and it is getting more and more untidy the more I try to craft it to my needs.

The problem I have right now is that when the mouse clicks outside of a button, it reloads the image (in this case firstImage.)


_root.onEnterFrame function() {
	
jms_btn.onPress = function() {
myvar = 1 
}
tkno_btn.onPress = function() {
myvar = 2
}
kofi_btn.onPress = function() {
myvar = 3 
}
bolle_btn.onPress = function() {
myvar = 4 
}
don_btn.onPress = function() {
myvar = 5 
}
nchil_btn.onPress = function() {
myvar = 6 
}

if (myvar == 0) {
	myvar = 6 //loops it over
	firstImage();
	descrip.text = description[p];
	titletxt.text = header[p];
	picture.loadMovie(image[p], 1);

}
if (myvar == 7) {
		myvar = 1
		sixthImage;
		descrip.text = description[p];
		titletxt.text = header[p];
		picture.loadMovie(image[p], 1);
}

if (myvar == 1) {
if (myvar2 == 1) {
[COLOR="Red"]firstImage();[/COLOR]
jms_btn.gotoAndStop(2)
tkno_btn.gotoAndStop(1)
kofi_btn.gotoAndStop(1)
bolle_btn.gotoAndStop(1)
don_btn.gotoAndStop(1)
nchil_btn.gotoAndStop(1)
myvar2 = 0
}
//...

if (keyisbeingheld == 1) { 
if (Key.isDown(Key.UP)) {
if (myvar == undefined) {
                myvar = 1
                keyisbeingheld = 0
} else {
                myvar2 = 1
                myvar = myvar - 1
                keyisbeingheld = 0
            }
}
if (Key.isDown(Key.DOWN)) {
 if (myvar == undefined) {
                myvar = 1
                keyisbeingheld = 0
trace("keyundefined")
} else {
                myvar2 = 1
                myvar = myvar + 1
                keyisbeingheld = 0
            }
}
}
if (!(Key.isDown(Key.UP))) {
if (!(Key.isDown(Key.DOWN))) { 
keyisbeingheld = 1
}
}
}
_root.onMouseDown = function() {
myvar2 = 1
}

//..

function firstImage() {
	if (loaded == filesize) {
		picture._alpha = 0;
		picture.loadMovie(image[0], 1);
		titletxt.text = header[0];
		descrip.text = description[0];
		picture_num();
	}
}

Any help would be much appreciated.