Help with ComboBox and Images


hello guys,

 

i'm new here , new @ as3 , flash cs5x.

 

i'm trying create simple application when user select option @ combobox, text displayed on textarea (sex_txt) , image displayed @ stage (using addchild).

 

i've tried many options, when user select option "homem" or "mulher" image appears if changed selection these images overlapped.

 

the question is: how can use simple combobox 2 or more options , when option selected image belongs option shown on stage.

 

<code>

function sexselect(event:event):void{

sex_txt.text = cb1.selecteditem.label;

if (cb1.selecteditem.label = "mulher") {

     addchild(woman);

                    woman.x = 295

                    woman.y = 105

          } else {

addchild(man);

         man.x = 295

                    man.y = 105

};

</code>

use:

 

var prevadded:displayobject;

 

function sexselect(event:event):void{

sex_txt.text = cb1.selecteditem.label;

if(prevadded){

removechild(prevadded);

}

if (cb1.selecteditem.label = "mulher") {

     addchild(woman);

                    woman.x = 295

                    woman.y = 105

prevadded=woman

          } else {

addchild(man);

         man.x = 295

                    man.y = 105

prevadded=man

};

</code>



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

How to change text Component easybook reloaded *newbee* - Joomla! Forum - community, help and support

After Effect warning: A problem occurred when processing OpenGL commands

Preconditions Failed. - Joomla! Forum - community, help and support