PHWinfo banniere

Titres
PORTAIL ANNUAIRE ARTICLES COMPARATEUR HÉBERGEURS DEVIS FORUMS RÉDUCTEUR D'URL
Précédent   PHWinfo > Autres forums > Forum Graphisme & Infographie > macromedia.flash > Show/Hide Movie Clips with a Combo Box... !
S'inscrire FAQ Membres Recherche Messages du jour Marquer les forums comme lus
Show/Hide Movie Clips with a Combo Box... !

Réponse
 
LinkBack Outils de la discussion
Vieux 27/05/2008, 17h02   #1
SnakeRake
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Show/Hide Movie Clips with a Combo Box... !

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


  Réponse avec citation
Vieux 27/05/2008, 17h35   #2
NedWebs
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Show/Hide Movie Clips with a Combo Box... !

The combo box has a change event that you can listen for and use to code what takes place when a selection is made.
  Réponse avec citation
Vieux 27/05/2008, 18h37   #3
SnakeRake
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Show/Hide Movie Clips with a Combo Box... !

Hi ned, do you know where I might find a sample of this coding

Thanks,

-Blake
  Réponse avec citation
Vieux 27/05/2008, 19h14   #4
NedWebs
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Show/Hide Movie Clips with a Combo Box... !

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.

  Réponse avec citation
Vieux 27/05/2008, 20h01   #5
SnakeRake
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Show/Hide Movie Clips with a Combo Box... !

Thanks Ned,

I'm using ActionScript 2
  Réponse avec citation
Vieux 27/05/2008, 22h00   #6
NedWebs
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Show/Hide Movie Clips with a Combo Box... !

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();

  Réponse avec citation
Vieux 27/05/2008, 22h43   #7
SnakeRake
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: Show/Hide Movie Clips with a Combo Box... !

Wow,

Thanks so much Ned,

Just what I needed. I reallly appreciate it

-Blake
  Réponse avec citation
Réponse


Outils de la discussion

Règles de messages
Vous ne pouvez pas créer de nouvelles discussions
Vous ne pouvez pas envoyer des réponses
Vous ne pouvez pas envoyer des pièces jointes
Vous ne pouvez pas modifier vos messages

Les balises BB sont activées : oui
Les smileys sont activés : oui
La balise [IMG] est activée : oui
Le code HTML peut être employé : non
Trackbacks are oui
Pingbacks are oui
Refbacks are oui


Fuseau horaire GMT +1. Il est actuellement 08h40.


Édité par : vBulletin® version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC5 Tous droits réservés.
Version française #16 par l'association vBulletin francophone
PHWinfo est un site Éducation Sans Frontières ©2000-2008
Ad Management by RedTyger
©Tous droits réservés par les parties respectives
Page generated in 0,11716 seconds with 15 queries