View Full Version : yep, another problem with the ListBox component

03-11-2003, 01:57 PM
Thanks to the help of Cyanblue I've managed to get this far. I have a list box that is populated with external data. I have assigned data to each label. The user can select multiple packages.

After the user selects the indices (index) from the list box they click on a "View Packages" button. What I need this button to do is capture the data from the selected indices and save this data to a SharedObject. It sounds simple in principle but I'm having a heck of a time doing it. My problem lies with the "View Packages" button. I have no idea how to grab the data from the selected indices. I'd like to assign variables to each selected index. For example if they select the first two and then click the "View Packages" button I'd like something like this:

dataTransmission_1 = firstSelectedIndexfromListbox.data
dataTransmission_2 = secondSelectedIndexfromListbox.data

I hope this makes sense. I've included the file. I just need help with the "View Packages" button.

03-11-2003, 02:59 PM
remember that the listbox holds data as arrays so that being said this is the simplest way to save it to an so

function variableTransmission(){
if(packages_lb.getSelectedItems() != undefined){
activities_so.packages_array = packages_lb.getSelectedItems();

you can also loop through the array to manipulate the data anyway you want.


03-11-2003, 04:12 PM
So is this so you can retrieve the previously selected indices for a user when they return to the site. Let's consider this example. I assigned my listbox data in the movie for lack of motivation in writing the code to get it from a text file. You'll see where I update the sharedObject each time something is picked. Also I do a check at the beginning for an existing sharedObject. If one is found I use it to set the initial selected Indices. Is this what you are after.

arr = [];
arr.push({data:1, label:"one"});
arr.push({data:2, label:"two"});
arr.push({data:3, label:"three"});
arr.push({data:4, label:"four"});
arr.push({data:5, label:"five"});
arr.push({data:6, label:"six"});
arr.push({data:7, label:"seven"});
arr.push({data:8, label:"eight"});
arr.push({data:9, label:"nine"});
arr.push({data:10, label:"ten"});

myTmpIndices = myobj.data.dataArray;
if (myTmpIndices.length > 0) {

function showMe(component) {
myArr = component.getSelectedIndices();
myIndices = [];
for(x in myArr) {
if (myArr.length>3) {

function saveData(what) {
myobj.data.dataArray = what;

03-11-2003, 04:51 PM

You're the greatest!

03-11-2003, 10:12 PM
Yo, binkyboo... ListBox Component and Shared Object hate you that much??? :D


03-11-2003, 10:32 PM

My head has been spinning all day. I finally got this working the way I need it. I used bits and pieces of your code and some of freddy's too. What's funny is the instructional designers on the project will probably change everything. Scope creep is a major problem with my company. Thanks for your help.


ps My bro never got your stuff. You may want to try again because their budget was just approved so they have money allocated for hiring freelance Flash developers.

03-11-2003, 11:15 PM
Glad you got it working... ;) Who cares where the code comes from??? As long as you understand what you do, we all are happy for you... Besides that, I've had a chance to look up the Flash manual one more time... :D

What's funny is the instructional designers on the project will probably change everything.Geez... What do you mean??? I understand that there could be multiple developers for the project, but why do they have to change the working code??? Dang... Just shoot them all up and hire me!!! :D j/k (I think I played too much Diablo thesedays at home...)

As for the project... I did some research regarding some of the requirements you told me and I found that the stuff itself wasn't that hard thing to do, but as you have mentioned they need some experienced people for that... So, I thought that I won't get qualified for the job... I'll just keep my fingers crossed and try that... Thank you again... ;)