Component question

Hi Everyone.
Just had a question. Is ist possible for a listobx item to execute more than one function. For example, have a listbox item load a jpg, load some data into a text and maybe be crazy and setProperty of a specific object. What would the code look like. Is it possible to do it like the kirupa’s listbox tutorial? I’ve tried but no luck.

any takers. j

p.s. I really like this forum and this site. I just started learing Flash MX two weeks ago and I found great tutorials and great advice. Just wanted to say thanks.

you can run as many commands as you like

in the properties of the listbox component choose a name for your change handler (the code to execute when something changes in your listbox). I make most of mine “onChange”…

in a frame on my main timeline, I add some actionscript that looks something like this:


onChange=function(flistbox){
do this;
do that;
do the other; // just keep adding until you're done

}



Sorry But I’m still a little confused. How do I specify each listbox item.

I have about a hundred names I need to add to a listbox. Each name corosponds with a picture, some data and certain place on a map.

Right now I was using POM told me about and works great:

list.addItem(“them”,new Array(“movie5.swf”));

function loadMyMovie©{
var j = c.getSelectedItem().data;
loadMovieNum(j,1);
}

list.setChangeHandler(“loadMyMovie”)

But can I add more to this like load data and stuff? Please let me know. J

Well yes, you can put other things in there. For instance, if you want to load the movie and then go somewhere in the main movie:

list.addItem("them",new Array("movie5.swf",5));

function loadMyMovie(c){
	var j = c.getSelectedItem().data[0];
	var k = c.getSelectedItem().data[1];
	loadMovieNum(j,1);
	_root.gotoAndPlay(k);
}

list.setChangeHandler("loadMyMovie")

pom :cowboy:

dude, thank you so much. That worked miracles. Sweet. Now I have to add hundred names. thanks j

:cowboy:

Pom has this nasty habit of beating me to the answers…hehehe… That’s why he uses the cowboy smilies…fastest draw on the net. Whew… that was a lame joke…

thanks guys. you make it eassier to learn this program. I’ll probably be back for more question. Look out. j

[John Wayne accent]Inigo… :stuck_out_tongue: I’m glad you’re back. I was beginning to miss that will-I-post-before-him feeling…

Cheers![/John Wayne accent]

pom :cowboy:

“Why, Johnny Ringo, you look like someone just walked over your grave”-Doc Holliday, movie Tombstone

Yah… feels good to be back. I mean, I was posting around, but I was leaving the actual questions to other people. :slight_smile:

Yeehaw…