Actionscript help please

I trying to populate a combobox from a .php file and return the values of the selection. I have the .php set up to where it outputs something like

&artists=anartist,anartist2,anartist3, etc…they have names…

I already have the combobox set up to where it displays
anartist
anartist2
anartist3

after you click the dropdown arrow…

How would I get it to return a the numerical value for the artist (ex: anartist would be “0” since it is first in the list) and put it into a variable so that when it is selected it could be placed into an eval() function to create a variable such as “albumcover0” to be loaded through a function. I have been reading tutorials for hours to no avail. I want a single function to produce the number from the selected artist and place it into a variable, then go through all of the loadImage(for the “album image”) etc functions…they will be functions that I have made already previously and call all of them with the number in the called fuctions (ex: loadImage(0)) where “0” is the number derived from the variable out of the combo box. Ive tried tons of tutorials, I think that it has something to do with me using flash mx 2004, and as2 turned on. Could someone give me a code sample on how to do this please. Thank you very much in advance…

if you need anymore description, please ask…this is sortof urgent, thanks…

sorry for all of these bumps…I see that there are 16 people viewing the actionscript forum, maybe someone could help?

little update to make it more clear, I just want the index number of the selected item to be placed into a variable whenever something in the combobox is changed, here is the code so far…

function loadSite() {
var mainNumber=cbox.selectedIndex;
"loadImage(mainNumber);"
testvar = 2;
}
cbox.addEventListener(“change”, loadSite);

If I try to run the previously defined function loadImage, it says that it cant load “undefined”. The testvar shows up fine in a textbox upon changing the combobox, but when I try it with the mainNumber it doesent do anything, not even put up “undefined” in the textbox, so I guess that means that the problem lies with the “mainNumber” row, I tried the cbox.getSelectedIndex(); method, but it didnt work either…what am I doing wrong, thanks a whole lot for any help…

What movieclip should loadImage load into ? And what will the be name of the jpg/swf to be loaded ? Or is the loadImage function done already and is the mainNumber the problem ?

The mainNumber variable sure is correct. So that means that your function, loadImage, is also being called correctly, like loadImage(0) for the first element, loadImage(1) for the second etc. So what exactly should loadImage do ? Load the jpg album0.jpg, album1.jpg, … ?

Also, make sure to have given an instance name to your combobox.

yes, exactly, If I run loadImage(0) by itself it loads the image into the proper container just fine, but If I try to run it in that function, or just try to display the mainNumber as a variable in a textbox like the testvar variable it shows nothing in the textbox, if I try to run the loadImage(mainNumber) function it says something to the effect of “cant find c:/folder/folder/folder/undefined”.
If it helps any the function for loadImage is…
function loadImage(thenumber){
loadMovie(eval(“image”+thenumber), _root.imageholder);
}
where “image0” is the variable with the proper image url, it works just fine on its own tho…The combobox becomes populated from a php file just fine, and I made sure that the instance names were all correct, the instance name of the “selectIndex” function should be the instance name of the combobox right? Thanks for the help, hope that this info helps a bit…

Hmn, it doesn’t make sense that the loadImage(0) on itself works fine, but that the mainNumber doesn’t work, since it’s correct. Hmn. Can you send me your file so I can have a look at it ? It’s late here, so it’ll prolly be tomorrow when you get it, I hope your deadline’s not too tight ? (you said this was urgent …)

I hit ctrl+enter as I usually do and it just started working…I dont even remember what I changed, so much frustration over something so small, the deadline is actually in a few hours, but I’m almost done, thank you very much for offering your help.

Lol, alright :smiley: Glad you got things fixed :slight_smile: