Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/apache-flex/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/flash/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Apache flex 网格渲染器在不调用updateDisplayList的情况下更新_Apache Flex_Flash_Uicomponents - Fatal编程技术网

Apache flex 网格渲染器在不调用updateDisplayList的情况下更新

Apache flex 网格渲染器在不调用updateDisplayList的情况下更新,apache-flex,flash,uicomponents,Apache Flex,Flash,Uicomponents,我有一个网格的项目渲染器,它有一个相当基本的updateDisplayList函数: override protected function updateDisplayList( w : Number, h : Number ) : void { super.updateDisplayList( w, h ); var labelWidth : Number = Math.min( _labelDisplay.measuredWidth, w ); var labelH

我有一个网格的项目渲染器,它有一个相当基本的updateDisplayList函数:

override protected function updateDisplayList( w : Number, h : Number ) : void
{
    super.updateDisplayList( w, h );

    var labelWidth : Number = Math.min( _labelDisplay.measuredWidth, w );
    var labelHeight : Number = Math.min( _labelDisplay.measuredHeight, h );

    _labelDisplay.setActualSize( labelWidth, labelHeight );

    var labelX : Number = ( w - _labelDisplay.width ) / 2;
    var labelY : Number = ( h - _labelDisplay.height ) / 2;

    _labelDisplay.move( labelX, labelY );

    //this is just for debugging
    graphics.clear();
    graphics.beginFill( 0xFF0000, 0.5 );
    graphics.drawRect( labelX, labelY, labelWidth, labelHeight );
    graphics.endFill();
}
其中_labelDisplay是火花标签。当我滚动网格(这是一个cuatom网格,不是mx:grid或AndvancedDataGrid)时,当网格底部出现新行时,将调用updateDisplayList,并执行重新绘制背景和移动/调整标签大小的代码

问题是这些变化没有反映在视图中。文本对齐错误,因为用于显示大字符串的标签现在显示短字符串,因此测量宽度已更改

下一次我滚动渲染时,渲染将更新为它们应该更新的样子-但是这里不调用updateDisplayList(在渲染上)。所发生的一切就是渲染器在网格中重新定位。 背景和标签最初都显示不正确,因此不仅仅是标签行为不当

有人知道为什么会这样吗


谢谢

只是一个猜测,但这有什么区别吗

override protected function updateDisplayList( w : Number, h : Number ) : void
{
    var labelWidth : Number = Math.min( _labelDisplay.measuredWidth, w );
    var labelHeight : Number = Math.min( _labelDisplay.measuredHeight, h );

    _labelDisplay.setActualSize( labelWidth, labelHeight );

    var labelX : Number = ( w - _labelDisplay.width ) / 2;
    var labelY : Number = ( h - _labelDisplay.height ) / 2;

    _labelDisplay.move( labelX, labelY );

   super.updateDisplayList( w, h ); // Call updateDisplayList after moving / resizing _labelDisplay
}

向我们展示updateDisplayList()代码并不能帮助我们理解为什么不调用该方法。你必须提供更多。您正在扩展哪个组件?渲染器和网格是如何协同工作的?感谢您的回复。我不是在问为什么不叫它——我不想让它被叫不止一次。我在问为什么updateDisplayList函数应用的更新在下一次渲染之前不可见。