Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/6.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
Actionscript 3 火花图像边界框不缩放_Actionscript 3_Apache Flex_Flex Spark - Fatal编程技术网

Actionscript 3 火花图像边界框不缩放

Actionscript 3 火花图像边界框不缩放,actionscript-3,apache-flex,flex-spark,Actionscript 3,Apache Flex,Flex Spark,缩放Spark图像组件时,边界框不会随之缩放。这意味着父容器(在本例中为组)不完全符合图像边界。这个问题我已经问过好几次了,但我从未见过有人给出答案 当前正在使用的代码: this.headerArea = new Group(); this.headerArea.percentWidth = 100; this.headerArea.styleName = "pageHead"; this.scrollViewport.addElementAt( this.headerArea, 0 );

缩放Spark
图像
组件时,边界框不会随之缩放。这意味着父容器(在本例中为
)不完全符合图像边界。这个问题我已经问过好几次了,但我从未见过有人给出答案

当前正在使用的代码:

this.headerArea = new Group();
this.headerArea.percentWidth = 100;
this.headerArea.styleName = "pageHead";
this.scrollViewport.addElementAt( this.headerArea, 0 );

this.logo = new Image();
this.logo.source = "assets/images/logo.png";
this.logo.scaleMode = BitmapScaleMode.LETTERBOX;
this.logo.smooth = true;
this.logo.percentWidth = 75;
this.logo.horizontalCenter = 0;
this.logo.styleName = "headerLogo";
this.headerArea.addElement( this.logo );
徽标可缩放到我需要的大小,但顶部和底部都有大量的填充(随着图像的
percentWidth
减小而增加)


有什么解决办法吗?

据我所知,您的代码似乎是正确的。也许包含组的布局有问题?这实际上是再现错误所需的全部代码吗?@T.Richter headerArea被添加到视图中的滚动条中,但这些应该不会对此产生影响。当您使用“信箱”即“保持纵横比”和“百分宽度”组合时,将应用类似的百分比高度,以将图像的纵横比保持为组件(而不是图像本身)。从某种意义上说,这是有道理的,尽管我不得不承认这不是你所期望的。你知道如何解决这个问题吗?我想我们可以手动设置高度(
Image.contentHeight*Image.scaleX
可能会起作用;但我必须使用它),这将覆盖
percentHeight
。但是,这似乎是一种低效的方法,因为它必须依赖各种事件才能在所有情况下正常运行。如果将图像的
宽度
绑定到组的
{headerArea.width*3/4}