# Set selected index

**URL:** https://forum.kirupa.com/t/set-selected-index/6498
**Category:** Uncategorized
**Created:** [October 9, 2002, 1:41am UTC](https://forum.kirupa.com/t/set-selected-index/6498 "2002-10-09T01:41:10Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![waffe](https://avatars.discourse-cdn.com/v4/letter/w/c37758/32.png) [@waffe](https://forum.kirupa.com/u/waffe)
#### Post date: [October 9, 2002, 1:41am UTC](https://forum.kirupa.com/t/set-selected-index/6498/1 "2002-10-09T01:41:10Z")

</div>

I would like to use the flistbox command “set selected index”, to “my current index +1.” I am performing this command to select a song automaticly after a song stops in a music player.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 9, 2002, 2:50am UTC](https://forum.kirupa.com/t/set-selected-index/6498/2 "2002-10-09T02:50:08Z")

</div>

The code would look somthing like this:

mybox.setselectedindex (current index + 1)

Hope this helps Explain my question better.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 9, 2002, 3:10am UTC](https://forum.kirupa.com/t/set-selected-index/6498/3 "2002-10-09T03:10:17Z")

</div>

[http://www.kirupaforum.com/showthread.php?s=&threadid=7275](http://www.kirupaforum.com/showthread.php?s=&threadid=7275)

plus… I answered to other questions about that… please do a search for the code you’re looking for and you will find them.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 9, 2002, 4:08am UTC](https://forum.kirupa.com/t/set-selected-index/6498/4 "2002-10-09T04:08:54Z")

</div>

This is what I have so far:

screen.onSoundComplete = function() {  
newitem = getScrollPosition;  
getScrollPosition = getScrollPosition+1;  
combobox.setselectedindex(newitem);  
};

For some reasone the command does not happen the 1st time a sound completes. I have to select a sound a 2nd time before the code works.

Another problem is if I select a new item in my listbox with the arrow keys the “newitem = getscrollposition” seems to yield the wrong vaule.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 9, 2002, 4:12am UTC](https://forum.kirupa.com/t/set-selected-index/6498/5 "2002-10-09T04:12:45Z")

</div>

screen.onSoundComplete = function() {

combobox.setselectedindex(combobox.getselectedindex()+1);  
};

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 9, 2002, 4:23am UTC](https://forum.kirupa.com/t/set-selected-index/6498/6 "2002-10-09T04:23:26Z")

</div>

Thats a rap. Thanks for the hook up.

---

<div class="post-metadata">

### Author: ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)
#### Post date: [October 9, 2002, 5:15am UTC](https://forum.kirupa.com/t/set-selected-index/6498/7 "2002-10-09T05:15:38Z")

</div>

thanks for the great questions and answers, guys - this is some phat s\*\*\* - stuff:beam:
