Customise Combobox/DropDown in Flash
I am always wonder how to customise the Combobox component in Flash . It's easy to change the skin. Simply double click the component , enter each movieclip and change the style. But ever wonder how to change text color and it's position.
I will try to point out step by step procedure for customise it.
1. First create a class which extends ComboBox. I used DropDownComboBox for class name.
2. Second create another class for Cell render which extends CellRenderer. I used DropDownCellRenderer;
3. Open a new flash document and insert a combobox component in the stage.
4. Select ComboBox clip in the library. Right click on it and select Properties.
5. In the properties panel change the default Class to the custom class you wrote . ie, DropDownComboBox
6. Inside the DropSownComboBox constructer function type this code
dropdown.setStyle('cellRenderer', DropDownCellRenderer);
7. If you need to change the Text of ComboBox type the below code
textFormat = new TextFormat(new Font2().fontName, 11, 0xCC3333);
textField.setStyle('embedFonts', true);
textField.setStyle('textFormat', textFormat);
8. If you need to change the Text in dropDown cells type this code inside the DropDownCellRenderer class
this.setStyle('embedFonts', true);
this.setStyle('textFormat', new TextFormat(new Font2().fontName, 11, 0x000000));
9. If you need to change the text positions override the drawLayout function
override protected function drawLayout():void {
super.drawLayout()
textField.y += 10;
}
That's it . I have attached my code here. You can check it .
Comments
more brilliant times reading here. Thank you once more for everything
mts to mov mac
import flash.events.MouseEvent;
import flash.events.TransformGestureEvent;
import flash.ui.Multitouch;
import flash.ui.MultitouchInputMode;
Multitouch.inputMode = MultitouchInputMode.GESTURE;
stage.addEventListener(TransformGestureEvent.GESTURE_ZOOM , onZoom);
function onZoom (e:TransformGestureEvent):void{
this.scaleX *= e.scaleX;
this.scaleY *= e.scaleY;
}