PDA

View Full Version : Masking ComboBox component



psych
March 26th, 2009, 11:24 AM
Hi,

I have a problem masking ComboBox component. I am using following code:


import fl.controls.ComboBox;

var cb:ComboBox = new ComboBox();
cb.addItem({data:1, label:"One"});
cb.addItem({data:2, label:"Two"});
cb.addItem({data:3, label:"Three"});
cb.addItem({data:4, label:"Four"});
addChild(cb);

var masker:Sprite = new Sprite();
masker.graphics.beginFill(0xFFFFFF);
masker.graphics.drawRect(0,0,cb.width,cb.height);
masker.graphics.endFill();
addChild(masker);

cb.mask = masker;And ComboBox is masked fine (as test i used masker which is half height and width of the combobox and then only half of combobox was displayed) until i click on it, then whole ComboBox opens just as if it isn't masked. It looks like it breaks the masking thing :/ Did anyone have similar problems or maybe know what am i doing wrong?

thanks,
best regards

psych
March 26th, 2009, 12:08 PM
Hi,

I have a problem masking ComboBox component. I am using following code:


import fl.controls.ComboBox;

var cb:ComboBox = new ComboBox();
cb.addItem({data:1, label:"One"});
cb.addItem({data:2, label:"Two"});
cb.addItem({data:3, label:"Three"});
cb.addItem({data:4, label:"Four"});
addChild(cb);

var masker:Sprite = new Sprite();
masker.graphics.beginFill(0xFFFFFF);
masker.graphics.drawRect(0,0,cb.width,cb.height);
masker.graphics.endFill();
addChild(masker);

cb.mask = masker;And ComboBox is masked fine (as test i used masker which is half height and width of the combobox and then only half of combobox was displayed) until i click on it, then whole ComboBox opens just as if it isn't masked. It looks like it breaks the masking thing :/ Did anyone have similar problems or maybe know what am i doing wrong?

thanks,
best regards


Like it usually happens, i figured it out soon after positng problem :) In case someone else have the same problem, you should mask not the combo box instance but it's dropdown property so last line in my example should be:


cb.dropdown.mask = masker;:)