在 flex 中缩放 - 排除一些孩子? [英] Scaling in flex - exclude some children?

查看:29
本文介绍了在 flex 中缩放 - 排除一些孩子?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在 flex 中构建一个 webmap 应用程序.为此,我们有一个代表地图的 fxg 文件.它在一个该组中还有一些元素,例如 POI、文本等.我用 scaleX 和 scaleY 缩放,这对地图来说效果很好.

i'm trying to build a webmap application in flex. for ths, 've got a fxg-file which represents the maps. it's in a also there are some elements, like POIs, text et cetera in this group. i zoom the with scaleX and scaleY, this works just fine for the map.

但问题是:所有儿童也缩放.我不要这个.它们应该在地图上保持相同的位置和相同的大小.

but the problem is: ALL childen zoom also. i don't want this. they should stay the same place on the map and the same size.

这里有一些代码as函数

heres some code the as function

<fx:Script>

    <![CDATA[
        import mx.skins.Border; 
        [Bindable]
        public var hoehe:Number = 1;
        [Bindable]
        public var breite:Number = 1;

        protected function zoom_changeHandler(event:Event):void
        {
            hoehe = zoom.value;
            breite =  zoom.value;
        }
    ]]>
</fx:Script> 

    <s:Scroller width="100%" height="100%"   baseline="10">

<s:Group scaleX="{breite}" scaleY="{hoehe}"  id="mapView" > <!-- zum zoomen -->

    <s:Group horizontalCenter="0" > <!-- Enthält alle Objekte -->
    <images:karte  id="kartePanel" height="630" width="430" />
    <images:akw   id="akw1" scaleX="0.2" scaleY="0.2" top="158" left="190" />       
    <components:akwView x="154" y="131" resizeMode="scale">
    </components:akwView>
    </s:Group>
</s:Group>
</s:Scroller>

componentsLakwView 包含一些标签等,不应该调整大小吗?

componentsLakwView contains some labels etc. this should not be resized?

推荐答案

您可以为那些具有相反值的子级取消缩放 - 例如,如果将缩放 2.0 应用于父级,则对这些子级应用 1/2.0 = 0.5 比例,并且它们的大小将保持不变.

You can negate zoom for those children with inverse value - for example, if you apply zoom 2.0 to parent, apply 1/2.0 = 0.5 scale to those children, and their size will be constant.

这篇关于在 flex 中缩放 - 排除一些孩子?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆