缩小范围 - 排除一些孩子? [英] Scaling in flex - exclude some children?

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

问题描述

我正在尝试在flex中构建一个webmap应用程序。
为ths,'有一个fxg文件,代表地图。
它在
中也有一些元素,如POI,文本等等。
我用scaleX和scaleY缩放,这对地图很好用。



但问题是:ALL childen缩放。我不想要这个他们应该保持在地图上相同的位置。



将某些代码
作为函数

 < fx:脚本> 

<![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:脚本>

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

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

< s:Group horizo​​ntalCenter =0> <! - Enthältalle Objekte - >
< images:karte id =kartePanelheight =630width =430/>
< images:akw id =akw1scaleX =0.2scaleY =0.2top =158left =190/>
< components:akwView x =154y =131resizeMode =scale>
< / components:akwView>
< / s:组>
< / s:组>
< / s:Scroller>

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

解决方案

您可以对具有反值的那些孩子进行否定缩放 - 例如,如果将缩放2.0应用于父项,则将1 / 2.0 = 0.5比例应用于这些孩子,他们的大小将不变。


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.

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> 

and the

    <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 contains some labels etc. this should not be resized?

解决方案

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.

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

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