flex卷轴切割内容

时间:2011-06-16 12:03:54

标签: flash flex actionscript-3 scroll

获得了一个灵活的应用程序,其内容是可缩放的。 首先是一些代码

<s:Scroller  verticalScrollPolicy="on"  width="100%" height="100%">



<s:Group scaleX="{breite}" scaleY="{hoehe}" 

         id="mapView" > <!-- zum zoomen -->

    <s:Group horizontalCenter="0"  id="kartePanel"  verticalCenter="0">
    <images:karte  height="630" width="430"   />


        <components:akwOnMap data="{biblis}" verticalCenter="{biblis.y}" horizontalCenter="{biblis.x}" 
                             scaleY="{negate}" scaleX="{negate}" toolTip="{biblis.name}"/>



        <components:akwOnMap data="{akw2}" verticalCenter="{akw2.y}" horizontalCenter="{akw2.x}" 
                             scaleY="{negate}" scaleX="{negate}" toolTip="{akw2.name}"/>

            <components:akwView scaleX="{negate}" data="{akw2}" scaleY="{negate}" verticalCenter="20" horizontalCenter="{80}" >
        </components:akwView> 
    </s:Group>
</s:Group>
</s:Scroller>

通过使用滑块将值从1更改为3,缩放工作正常。缩放的中点是容器的中心(地图)。

我的问题:当我缩放时,滚动条会切割一部分组。它缩小了窗外?!

1 个答案:

答案 0 :(得分:1)

private function checkScrolling():void

{


var imgWidth:Number = mapView.width * mapView.scaleX;
    var imgHeight:Number = mapView.height * mapView.scaleY;

if (mapGroup.contentWidth < imgWidth ||
    mapGroup.contentHeight < imgHeight)
{
    var excessW:Number = imgWidth - mapGroup.contentWidth;
    var excessH:Number = imgHeight - mapGroup.contentHeight;
    mapGroup.setContentSize(imgWidth, imgHeight);
    /*
    if (scroller.horizontalScrollBar)
    {
        scroller.horizontalScrollBar.minimum = -excessW;
        scroller.horizontalScrollBar.maximum = excessW;
        mapGroup.horizontalScrollPosition = 0; 
    }
    */
    if (scroller.verticalScrollBar)
    {
        scroller.verticalScrollBar.minimum = -excessH;
        scroller.verticalScrollBar.maximum = excessH;
        mapGroup.verticalScrollPosition = 0;
    }

这个工作正常。