actionscript-3 - 仅增加一个 ItemRender 的高度

标签 actionscript-3 apache-flex flex4 flex4.5 itemrenderer

我正在尝试使用 Flex 开发调用日志,但在 ItemRender 方面遇到一些问题。事实上,这就是我所得到的:

The original state

当您单击某个项目时,该项目的大小会发生变化以显示更多详细信息:

The clicked state

但正如您所看到的,每个项目都会受到此调整大小的影响。平铺布局采用最高渲染并将其高度应用于其他渲染。

这是我的代码,我在其中调用渲染:

    <s:DataGroup id="TileListUsers"
                 left="10" right="10" top="10" bottom="10" width="300"
                 itemRenderer="assets.render.CallLogRender"
                 dataProvider="{ListCall}"
                 horizontalCenter="0" verticalCenter="0" contentBackgroundAlpha="0.0">
        <s:layout>
            <s:TileLayout horizontalGap="15" requestedColumnCount="1" verticalGap="15" />
        </s:layout>
    </s:DataGroup>

在渲染中,我使用了三个 BorderContainer,一个用于第一个 block ,一个用于第二个 block ,一个用于它们之间显示的详细信息:

        override public function set data(value:Object):void {
            super.data = value;

            CallerIDLabel.text = "Appel du : " + data.CallerID;
            StartHourLabel.text = data.StartHour;
            StartDateLabel.text = data.StartDate;
            if(value == null){
                return;
            }
            if (!data.Answer){      
                ShadowColor.color=0xCC9900;
                CallerIDLabel.text = "Appel manqué : " + data.CallerID;
                SourceIcon.source=callFinished;
            }   
        }

        private function onClick():void{
            if (data.Answer){
                this.height=170;
                DetailLineContainer.visible=true;
                SecondBlocContainer.visible=true;
            }
        }
    ]]>
</fx:Script>


<s:BorderContainer id="DetailLineContainer" x="0" y="39" width="100%" height="101"
                   backgroundAlpha="0.0" borderColor="#FFFFFF" borderVisible="false"
                   borderWeight="1" cornerRadius="5" visible="false" >
    <s:Line id="LineDetail" x="25" y="0" height="100%">
        <s:stroke>
            <s:SolidColorStroke color="#aeaeae" weight="3" caps="square"/>
        </s:stroke>
    </s:Line>
    <s:Graphic x="21" y="25" width="8" height="8">    
        <s:Ellipse x="0" y="0" width="8" height="8">
            <s:fill>
                <s:SolidColor id="CircleColor" color="#5b5b5b"/>
            </s:fill>
        </s:Ellipse>
    </s:Graphic>
    <s:Graphic x="21" y="53" width="8" height="8">    
        <s:Ellipse x="0" y="0" width="8" height="8">
            <s:fill>
                <s:SolidColor id="CircleColor2" color="#5b5b5b"/>
            </s:fill>
        </s:Ellipse>
    </s:Graphic>
    <s:Label id="DurationLabel" x="35" y="25" width="250"
             color="#929292" fontFamily="proxima" fontSize="13"
             text="Durée de l'appel : 13 minutes 23 secondes" textAlign="left"
             verticalAlign="top"/>
    <s:Label id="QualityLabel" x="35" y="52" width="250"
             color="#929292" fontFamily="proxima" fontSize="13"
             text="Qualité de l'appel : moyenne" textAlign="left"
             verticalAlign="top"/>
</s:BorderContainer>

<s:BorderContainer id="FirstBlocContainer" width="100%" height="50" click="onClick()" backgroundColor="#FFFFFF"
                   borderColor="#FFFFFF" borderVisible="false" borderWeight="1" cornerRadius="5">
    <s:BorderContainer width="50" height="50" borderVisible="false" backgroundAlpha="0.0">
        <s:Graphic id="Shadow" x="0" y="0" width="100%" height="100%">
            <s:Rect x="0" y="0" width="50" height="50" bottomLeftRadiusX="5" topLeftRadiusX="5">
                <s:fill>
                    <s:SolidColor id="ShadowColor" color="#70b13c"/>
                </s:fill>
            </s:Rect>
        </s:Graphic>
        <s:Image id="SourceIcon" horizontalCenter="0"
                 source="@Embed('/assets/images/CallLogIncomming.png')" verticalCenter="0"/>
    </s:BorderContainer>

    <s:Graphic id="CallState" x="0" bottom="0" width="100%" height="2%" alpha="0.15">
        <s:Rect x="0" y="-1" width="260" height="2">
            <s:fill>
                <s:SolidColor color="#000000"/>
            </s:fill>
        </s:Rect>
    </s:Graphic>
    <s:Label id="CallerIDLabel" left="60" width="180" color="#5B5B5B" fontFamily="proxima"
             fontSize="14" maxDisplayedLines="2" text="Appel du : 0636360400" textAlign="left"
             verticalAlign="middle" verticalCenter="0"/>
    <s:Label id="StartDateLabel" y="10" right="5" width="50" color="#C0C4C3" fontSize="12" text="08/04/14"
             textAlign="center" verticalAlign="middle"/>
    <s:Label id="StartHourLabel" y="24" right="5" width="50" color="#C0C4C3" fontSize="12"
             text="12:45" textAlign="center" verticalAlign="middle"/>
</s:BorderContainer>

<s:BorderContainer id="SecondBlocContainer" x="0" y="117" width="100%" height="50"
                   backgroundColor="#FFFFFF" borderColor="#FFFFFF" borderVisible="false"
                   borderWeight="1" cornerRadius="5" visible="false" >
    <s:BorderContainer width="50" height="50" borderVisible="false" backgroundAlpha="0.0">
        <s:Graphic id="CallState2" x="0" y="0" width="100%" height="100%">
            <s:Rect x="0" y="0" width="50" height="50" bottomLeftRadiusX="5" topLeftRadiusX="5">
                <s:fill>
                    <s:SolidColor id="ShadowColor2" color="#B1463C"/>
                </s:fill>
            </s:Rect>
        </s:Graphic>
        <s:Image id="SourceIcon2" horizontalCenter="0"
                 source="@Embed('/assets/images/CallLogFinished.png')" verticalCenter="0"/>
    </s:BorderContainer>

    <s:Graphic id="Shadow2" x="0" bottom="0" width="100%" height="2%" alpha="0.15">
        <s:Rect x="0" y="-1" width="260" height="2">
            <s:fill>
                <s:SolidColor color="#000000"/>
            </s:fill>
        </s:Rect>
    </s:Graphic>
    <s:Label id="CallerIDLabel2" left="60" width="180" color="#5B5B5B" fontFamily="proxima"
             fontSize="14" maxDisplayedLines="2" text="Vous avez raccroché" textAlign="left"
             verticalAlign="middle" verticalCenter="0"/>
    <s:Label id="StopDateLabel" y="10" right="5" width="50" color="#C0C4C3" fontSize="12" text="08/04/14"
             textAlign="center" verticalAlign="middle"/>
    <s:Label id="StopHourLabel" y="24" right="5" width="50" color="#C0C4C3" fontSize="12"
             text="12:45" textAlign="center" verticalAlign="middle"/>
</s:BorderContainer>

有没有一种方法可以让 TileLayout 只增加一个组件的高度而不影响其他组件?

最佳答案

如果只有一列,为什么要使用TileLayout?使用 VerticalLayout 并将其 variableRowHeight 属性设置为 true。这是 example .

关于actionscript-3 - 仅增加一个 ItemRender 的高度,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22957160/

相关文章:

actionscript-3 - Adobe AIR - .air 到 .exe/.dmg/.rpm

sql - AIR Sqlite : SQLEvent. 结果未触发,但语句正在正确执行

ios - 应用内购买 freshplanet-as3

php - 使用带有特殊字符的 SimpleXML 在 PHP 中创建 XML

java - Flex 4.6 的未知异常 :AMF 15 while migrating from Flex 3. 2

apache-flex - 绑定(bind)存在 ActionScript 中的属性

apache-flex - Maven 和 Flex 生成器

apache-flex - 我无法将自定义事件从一个模块分派(dispatch)到另一个模块,因为它给出了 TypeError : Error #1034: Type Coercion failed:

.net - 访问 .NET 服务时,WebORB 会增加什么值(value)?

flash - 具有自定义刻度和轴的 Flex 图表