PDA

View Full Version : how to make a list box global, or something like that?


sjbeatle
1-16-06, 10:02 AM
I have items in a listbox (coversLBX), and I want an event in a "nested" .swf file to select a different item in the listbox. Right now, I can't get it to work.

Basically, in the "nested" .swf I have the syntax:
coversLBX.setSelectedIndex(0);

But this will not work because the listbox is not located in the same .swf as that syntax.

I had a similar problem in the past where I needed an event in a "nested" .swf to call a function in the main .swf, and the solution was to make the function global.

Is it possible to make a listbox global, or does that not make any sense? If so, how? If not, what other possible solutions are there?

Thanks for listening,
Steve

sjbeatle
1-16-06, 10:53 AM
All right, I found a solution, so there's no need to reply. I'll post the solution that I decided to use. Feel free to post alternate (and most likely better) solutions if you know them, and you'd like to share.

What I ended up going with is creating a global function in the .swf that the listbox is located in where I placed the setSelectedIndex() function as so:

_global.listChange = function (listIndex) {
coversLBX.setSelectedIndex(listIndex);
}

Then I added the following syntax in the "nested" .swf where appropriate:

_global.listChange(0)

This works beautifully.

Thanks anyway! :)