PDA

View Full Version : Someone put me out of my misery!!!!


mistermikeb
02-16-2004, 07:24 AM
Hiya,

having a nightmare with a combo box - the following code is in the constructor of a movie


function mFinderPanel(){
trace("finder panel constructor called");
this.combo=this.attachMovie("lnkComboChooser","iCombo",10);
arr=new Array("one","two","three")
this.combo.iChooser.setDataProvider(arr);
//this.populateChooser();
};


so, Ive got a combo box attached, which has an instance name of iChooser inside its clip - I want to populate it but it wont let me, nothing happens (hence I tried the simple example above)!!!

any ideas why this isnt working????

thanks

mike

ericlin
02-16-2004, 08:40 AM
So you have a component iChooser in the iCombo.

Is your iChooser created by attachMovie in the constructor of lnkComboChooser ?

As discussed in your previous thread, do you create your child component all by attachMovie ?

mistermikeb
02-16-2004, 08:43 AM
hiya,

no, iChooser is just dragged on, and given instance name of iChooser? -is this wrong do you think?

thanks

mike

ps even more bizarrely, I can make it disappear using
this.combo.iChooser._visible=false;
but cant assign data to it? why
????

red penguin
02-16-2004, 10:09 AM
arr = [{label:'label one', data:'one'}, {label:'label two', data:null}];

Try using an array of Objects ?? What is 'this' in this context?

ericlin
02-16-2004, 10:20 AM
http://www.actionscript.org/forums/showthread.php3?s=&threadid=41634

I quote my reply:
your iChooser is still an ordinary movieClip, not yet a component
It is a movieClip, so you can set its _visible. But it is not yet a component, so you can not do setDataProvider(arr) which is a class method;

mistermikeb
02-16-2004, 10:32 AM
thanks guys,much appreciated, will try that red penguin

ericlin? so how do I get the data into it? why is it not a component yet - can I call its constrcutor or something to force it to instantiate as a component?

thanks

mike

ericlin
02-16-2004, 10:53 AM
I explained in last thread.

Try "attachMovie" to create your child component instance. Do not create it by dragging from library.

If senocular drops in, he may explain things better. Otherwise, you may do a search.

mistermikeb
02-16-2004, 11:07 AM
thanks ericlin,

i thought I was using attachmovie

this.combo=this.attachMovie("lnkComboChooser","iCombo",10);

here...............?

will try a search

mike

mistermikeb
02-16-2004, 11:29 AM
now i see,

this.attachMovie("FComboBoxSymbol","iCombo",0);

cheers, thanks for your help

red penguin
02-16-2004, 11:30 AM
Try simply attaching _the_ Component itself first. Then nesting it if that's what you are doing...

// snippet of codage
...
comboBox = _comboBox_mc.attachMovie('ComboBox', 'comboBox_' add q, q, {_x:0, _y:25});
comboBox.setDataProvider(this.screens_obj[name].question_obj[q].answers_arr);
...