PopUpManager + TitleWindow + Form:helpContent在TitleWindow之外绘制

时间:2011-09-11 08:37:24

标签: flex forms flex4 popup flex4.5

我正在尝试将设置弹出窗口添加到我的Flex 4.5应用程序中,但问题是,由于某种原因,Form帮助字符串是在TitleWindow之外绘制的。在表单中添加 width =“100%”height =“100%”不会改变任何内容:

screenshot

请有人知道如何处理这个案子吗?

以下是我非常简单的测试代码。如果将其粘贴到Flash Builder 4.5项目中,您将立即看到问题。

SettingsTest.mxml:

<s:Application 
    xmlns:fx="http://ns.adobe.com/mxml/2009"
    xmlns:s="library://ns.adobe.com/flex/spark"
    xmlns:mx="library://ns.adobe.com/flex/mx"
    xmlns:comps="*"
    width="700" height="525" >

    <fx:Script>
        <![CDATA[
            import mx.managers.PopUpManager;

            private function showSettings(event:MouseEvent):void {
                var _settings:Settings =
                    PopUpManager.createPopUp(this, Settings, true) as Settings;
                PopUpManager.centerPopUp(_settings);
            }           
        ]]>
    </fx:Script>

    <s:Button right="10" bottom="10" label="Settings" click="showSettings(event)" />

</s:Application>

Settings.mxml:

<?xml version="1.0" encoding="utf-8"?>
<s:TitleWindow xmlns:fx="http://ns.adobe.com/mxml/2009" 
    xmlns:s="library://ns.adobe.com/flex/spark" 
    xmlns:mx="library://ns.adobe.com/flex/mx"
    width="400" height="300"
    close="handleClose()"
    creationComplete="init(event)">

    <fx:Script>
        <![CDATA[
            import mx.events.FlexEvent;
            import mx.managers.PopUpManager;
            import flash.filters.ColorMatrixFilter;

            private var _settings:SharedObject =
                SharedObject.getLocal('settings');

            public function init(event:FlexEvent):void {
                handleHide(null);
            }

            private function handleClose():void {
                PopUpManager.removePopUp(this);
            }

            private function handleHide(event:Event):void { 
                var hide:Number = _hide.value;
                _settings.data.hide = hide;
                _settings.flush();

                if (hide >= 0.8) {
                    filters = null;
                } else {
                    var matrix:Array = new Array();
                    matrix = matrix.concat([1, 0, 0, 0, 1]);    
                    matrix = matrix.concat([0, 1, 0, 0, 1]);    
                    matrix = matrix.concat([0, 0, 1, 0, 1]);    
                    matrix = matrix.concat([0, 0, 0, hide, 1]); 

                    filters = [ new ColorMatrixFilter(matrix) ];
                }
            }
        ]]>
    </fx:Script>

    <s:Form width="100%" height="100%">
        <s:FormItem label="Invisible:">         
            <s:HSlider id="_hide" minimum="0.25" maximum="1.00" value="1.00" stepSize="0.25" change="handleHide(event)" />
            <s:helpContent>
                <s:Label text="Make the game less visible at the screen" />
            </s:helpContent>
        </s:FormItem>   
    </s:Form>
</s:TitleWindow>

1 个答案:

答案 0 :(得分:1)

这不是Form问题,而是我认为的Label问题。尝试将width="100%"添加到标签或在其上指定绝对宽度。