# Button programming

**URL:** https://forum.kirupa.com/t/button-programming/36494
**Category:** flash
**Created:** [November 27, 2003, 9:46am UTC](https://forum.kirupa.com/t/button-programming/36494 "2003-11-27T09:46:45Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Rainblade](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@Rainblade](https://forum.kirupa.com/u/Rainblade)
#### Post date: [November 27, 2003, 9:46am UTC](https://forum.kirupa.com/t/button-programming/36494/1 "2003-11-27T09:46:45Z")

</div>

I was struggling with some coding in this button and I was wondering if you guys could help me out.

## I have a frames page with a “main” page above and a “footer” page on the bottom. The main page is a html document with a image on it. I have swf loaded into the footer. The swf has two buttons on either side: “next” and “prev”. And I have a list box in the middle. I have a archive of html’s with loaded images that I am going to call up to “main” with the list box and buttons. Kinda like a slide show or online comic Idea (hint: if you dont know what Im talking about visit: [http://www.ctrlaltdel-online.com/](http://www.ctrlaltdel-online.com/). And go to there comics section). Now the list box was easy enough I used this code below on the frame it is in:

## archive.setChangeHandler(“open”); function open() { var x; getURL(archive.getSelectedItem(1).data+".html", “main”); getURL(archive.getSelectedItem(2).data+".html", “main”); getURL(archive.getSelectedItem(3).data+".html", “main”); getURL(archive.getSelectedItem(4).data+".html", “main”); getURL(archive.getSelectedItem(5).data+".html", “main”); }

“archive” being the name of the listbox.  
I put the names of the html files in the “data” section under the parameters of the listbox(Data: comic001, comic002, comic…).

But now when it came to set the buttons I don’t know how I would add to the number(next) to the html name or subtract(prev) from the name.

## I have been trying to do this but the only code I can come up with is this for the frame:

## archive.setChangeHandler(“open”); function open() { var x; getURL(archive.getSelectedItem(1).data+".html", “main”); getURL(archive.getSelectedItem(2).data+".html", “main”); getURL(archive.getSelectedItem(3).data+".html", “main”); getURL(archive.getSelectedItem(4).data+".html", “main”); getURL(archive.getSelectedItem(5).data+".html", “main”); } if (archive.getScrollPosition(1)) { x = 1; } if (archive.getScrollPosition(2)) { x = 2; } if (archive.getScrollPosition(3)) { x = 3; } if (archive.getScrollPosition(4)) { x = 4; } if (archive.getScrollPosition(5)) { x = 5; }

## and this for the button:

## on (release) { getURL(archive.getSelectedItem(x + 1).data+".html", “main”); }

This is how I figured it: I thought that by gathering the position that the listbox was currently on I could make that into a variable(x) to use for the button. Then in the button I use the variable and (+/-) one from it.

I’m open to suggestions, and mabye overhalls on structure. Except I need to keep the frames Idea b/c of extentiuating circumstances.
