【问题标题】:Adding LegendItems in Flex places horizontally not vertically (as it's supposed to)在 Flex 中添加 LegendItems 水平而不是垂直放置(因为它应该是)
【发布时间】:2009-04-25 00:55:16
【问题描述】:

我正在使用以下代码将 LegendItems 动态插入到图例中:

signalLegend.removeAllChildren();
signalLegend.direction = "vertical";
for (var i:int = 0; i < numItems - 1; i++) {
    signalLegend.addChild(new LegendItem());
    legendItem = signalLegend.getChildAt(i) as LegendItem;
    legendItem.label = "Title here";
    legendItem.setStyle("fill", theColour);
}

虽然图例方向设置为垂直,但所有项目均水平显示。

很烦人。

【问题讨论】:

    标签: apache-flex actionscript-3 uicomponents legend


    【解决方案1】:

    使用 labelPlacement 样式

    【讨论】:

      【解决方案2】:

      这似乎是一个错误。如果在运行时添加 Legend 控件的子项,它们的位置会出错。 将方向设置为“水平”,项目将垂直显示。 :-)

      【讨论】:

        【解决方案3】:

        好的,我找到了解决办法。

                        <mx:Legend id="nhLeg"
                               updateComplete="LegendPosition()"
                               direction="vertical"
                               width="80%"/>
        

        然后在 LegendPosition() 函数中:

                    private function LegendPosition():void
                {
        
                    nhLeg.direction="vertical";
                }
        

        【讨论】:

          猜你喜欢
          • 2012-12-05
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-11-20
          • 1970-01-01
          • 2012-08-24
          • 1970-01-01
          相关资源
          最近更新 更多