我想在flex 4中调整DropDownList控件的宽度。我可以通过编辑skinclass并将PopupAnchor的属性“popUpWidthMatchesAnchorWidth”设置为false来实现,但在我的应用程序中我必须使用actionscript来完成。
答案 0 :(得分:2)
答案 1 :(得分:1)
非常感谢所有响应者。在这里,我给出了用于剪切下拉列表宽度的代码。
包 { import spark.components.DropDownList; import mx.controls.Alert; import spark.components.PopUpAnchor; import mx.collections.IList; import spark.components.ComboBox;
public class customDDList extends DropDownList
{
[SkinPart(popUpWidthMatchesAnchorWidth)]
public var popUp:PopUpAnchor ;
public function customDDList():void
{
super();
}
override protected function partAdded(partName:String, instance:Object):void
{
super.partAdded(partName, instance);
if (partName == "popUp")
{
instance.popUpWidthMatchesAnchorWidth = false;
}
}
public override function set dataProvider(value:IList):void
{
super.dataProvider = value;
}
}
}
答案 2 :(得分:0)
你也可以为DropDownList组件创建另一个皮肤,并在popUpWidthMatchesAnchorWidth
皮肤部分上将false
属性设置为PopUpAnchor
:
<s:PopUpAnchor id="popUp"
displayPopUp.normal="false" displayPopUp.open="true" includeIn="open"
left="0" right="0" top="0" bottom="0"
itemDestructionPolicy="auto"
popUpPosition="below"
popUpWidthMatchesAnchorWidth="false" >