all groups > flash actionscript > may 2004 >
You're in the

flash actionscript

group:

comboBox not remembering its state.


Re: comboBox not remembering its state. Jack.
5/1/2004 4:17:07 PM
flash actionscript:
an alternative would be to keep the existing combobox
intact and refresh the values, this is code for Flash6 MX

aLabel1 = ["L1-1","L1-2","L1-3","L1-4"];
aData1 = [2,3,4,5];

aLabel2 = ["L2-1","L2-2","L2-3","L2-4"];
aData2 = [6,7,8,9];

populate = function(c,l,d,o,arr){
arr = new Array();
for (id=0; id<l.length; id++) {
o = new Object();
o.label = l[id];
o.data = d[id];
arr[id] = o;
}
c.setDataProvider(arr);
c.setChangeHandler("handle");
};

//initialize
populate(myCBox,aLabel1,aData1,obj1,arr1);
//change with
populate(myCBox,aLabel2,aData2,obj2,arr2);

hth ?
comboBox not remembering its state. andles
5/1/2004 11:37:31 PM
This is really weird. My comboBox is drawn from scatch with each click of a
'next' button. The first time it appears it has the currently selected item
as it was set - in my case, the label "Naviagtor". Yet on the next screen my
top selection drops down to second leaving a blank space at the top . The
changes have been made to the comboBox by way of a set of code that attaches
it all over again with the fresh info - NOT by ammending the one that was
already there. Yet it refuses to appear with the label "Naviagator" as the
one right before it did. Instead the comboBox has the top entry blank and my
"Navigator" label as the hidden next choice down.

I say that its weird as this is the same code that ran just a second before
to create the comboBox, yet it came out completely differnt when i run the
same code a seconds or so later. I am attaching at the same level as where
the last one resided and I am in no way even reffering to the old one.
setSelectedItem() and other methods fail to have any effect. My solution has
been to superimpose my own label over the top of a blank comboBox item -
harldy ideal.

Any ideas anyone??

Andles

Re: comboBox not remembering its state. andles
5/2/2004 5:36:50 PM
Thanks jack;

This was my origianl thought, and though I have not tried it yet, I suspect
it should work. My real problem is that I cant make sense of why it is
happening!! Even when I explicitly remove the previous movie clip and delete
the compoenent the preblem persists!

Is there something fundamental abou the way component work that causes this?
I certainly have never seen anything like it with java swing components.

I will post and advise if your code did the trick.

Andles.

[quoted text, click to view]

Re: comboBox not remembering its state. tviman
5/9/2004 9:53:23 PM
I'm having the same problem. I have several combo boxes, radio buttons, and
check boxes on a form. I also have a form validation script that is fired when
the user clicks the Submit button. If there is an error, I take the user to
the next frame in the movie clip, display some "error" text and a BACK button.
When the user clicks the BACK button, they are returned to the form but none of
the comboboxes , radio buttons, or check boxes remember their respective
states.

There's got to be a simpler way to maintain the states of these components.
Currently, I can trap the selectedIndex() of the combo boxes, and the "clicked"
states of the buttons and check boxes but nothing I've tried will return any of
these components to their previous states. I'd be grateful for any clues on
how to get this done.
AddThis Social Bookmark Button