Flex 4 图像填充
我有一个控件。我将其放入 Flex4 AIR 应用程序中。
我把它设置为x=0,y=0。 宽度=100%,高度=100%。
问题在于,我使用的源图像不适合整个应用程序屏幕。实际的controls.Image覆盖了整个屏幕,但是controls.Image中包含的源图像并没有填充整个controls.Image的高度/宽度。
有没有办法用源“填充”整个controls.Image? 我不担心扭曲源图像,我只想填充整个控件。图像,无论它的高度/宽度是多少。
我找不到这样做的工具..有人推荐提示吗?我找不到与“FillMode”或类似内容相关的任何内容,并且已经搜索了一段时间。
谢谢
I have a controls.Image that I put in my Flex4 AIR App.
I set it to x=0, y=0.
Width=100%, Height=100%.
The problem with this, is that The source image I am using does not fit the whole app screen. The actual controls.Image covers the entire screen, but the source image contained in the controls.Image does not fill the entire controls.Image height/width.
Is there any way to "fill" the entirety of the controls.Image with the source?
I am not worried about warping the source image, I would just like to fill the entire controls.Image no matter what the height/width of it are.
I cannot find the tool to do so.. anyone recommend tips? I cannot find anything related to "FillMode" or similar and have been searching for awhile now.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果“controls.Image”指的是
mx.controls.Image
,它在技术上是 Flex 3 组件,但适用于 Flex 4.1 及更早版本,那么您需要设置maintainAspectRatio
code> 更改为false
,并确保scaleContent
为true
(这是默认值)。另一方面,如果您使用的是 Flex 'Hero' SDK (Flex 4.5),它引入了本机 Spark 图像组件 (
spark.components.Image
),则您需要设置将scaleMode
设置为BitmapScaleMode.STRETCH
,并确保将fillMode
设置为BitmapFillMode.SCALE
(这是默认值)。AS3 文档:
mx.controls.Image(Flex 4.1 及更早版本)
spark.components.Image(Flex 4.5“英雄”)
If by 'controls.Image', you mean
mx.controls.Image
, which is technically a Flex 3 component, but is applicable in Flex 4.1 and earlier, you want to setmaintainAspectRatio
tofalse
, and make sure thatscaleContent
istrue
(which is the default value).On the other hand, if you are using Flex 'Hero' SDK (Flex 4.5), which introduces a native spark image component (
spark.components.Image
), you'll need to setscaleMode
toBitmapScaleMode.STRETCH
, and make surefillMode
is set toBitmapFillMode.SCALE
(which is the default value).AS3 Documentation:
mx.controls.Image (Flex 4.1 and earlier)
spark.components.Image (Flex 4.5 "Hero")
所有这些技巧都假设图像的空白部分是透明的。
-您可以将图像放入BorderContainer中,并设置容器的背景颜色。
-您可以创建特定宽度或高度的位图,然后填充背景颜色(我相信是 bitmap.fill )。然后将我们的图像位图数据复制到上面。
就我个人而言,我认为 BorderContainer 选项是最容易实现的。
All of these tips are assuming that the blank parts of the image are transparent.
-You could put your image in a BorderContainer, and set the background color of the container.
-You could create a bitmap of a certain width or height, then fill with a background color (bitmap.fill I believe). Then copy our image bitmap data onto that.
Personally, I think the BorderContainer option is the easiest to get off the ground.