|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Hi All,
I was hoping someone here could point me in the right direction with this. I have a combo box that loads data from an xml file that I want to use to toggle the visibility of different movie clips on the stage. Is this something I need to do in ActionScript(can I?) or does it need to be done in the component inspector, or can it even be done this way. Thanks -Snake |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
The combo box has a change event that you can listen for and use to code what takes place when a selection is made.
|
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
Hi ned, do you know where I might find a sample of this coding
Thanks, -Blake |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
You should be able to look up the ComboBox in the Flash file and the
properties, methods, and events will be defined. They usually provide examples that you can use to begin from. If you indicate which version of actionscript you are using I can probably provide a few details. |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
Thanks Ned,
I'm using ActionScript 2 |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
For the code below, there are three movieclips involved, having instance names
"mc1", "mc2", and "mc3" which are assigned as the data value of each combobox item. The combobox has an instance name of "cbox". For this case, since the combobox has the first item selected by default, the first movieclip, mc1, is displayed. If you study the code you will hopefully come to understand it enough to model it to your specific needs. // cbox.addItem(label, data); cbox.addItem("movie clip 1", "mc1"); cbox.addItem("movie clip 2", "mc2"); cbox.addItem("movie clip 3", "mc3"); var listener:Object = new Object(); listener.change = function(eventObject:Object) { showSelectedMC(); }; cbox.addEventListener("change", listener); function showSelectedMC(){ // first hide all mc's for(i=0; i<cbox.length; i++){ this[cbox.getItemAt(i).data]._visible = false; } // then show the selected one this[cbox.selectedItem.data]._visible = true; } showSelectedMC(); |
|
|
|
#7 |
|
Messages: n/a
Hébergeur: |
Wow,
Thanks so much Ned, Just what I needed. I reallly appreciate it -Blake |
|
![]() |
| Outils de la discussion | |
|
|