如何平滑用作控制皮肤的图像?
我正在嵌入这样的图像:
[Embed(source="/tool_deleteUp.png")]
private static const c_deleteButton_styleUp:Class;
我正在这样使用它:
_removeButton = new Button();
_removeButton.setStyle('upSkin', c_deleteButton_styleUp);
当我旋转按钮时,图像不会平滑缩放。 我知道人们用来缩放图像控件中加载的图像的技巧,但我正在用头撞墙,试图弄清楚如何在这里做到这一点。
帮助!
I'm embedding an image like this:
[Embed(source="/tool_deleteUp.png")]
private static const c_deleteButton_styleUp:Class;
I'm using it like this:
_removeButton = new Button();
_removeButton.setStyle('upSkin', c_deleteButton_styleUp);
When I rotate the button, the image doesn't scale smoothly. I know the tricks one uses to scale an image loaded in an Image control, but I'm banging my head against a wall trying to figure out how to do it here.
Help!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
一种巧妙的方法是遍历按钮的子/孙子,找到类型为
c_deleteButton_styleUp
的相应Bitmap
,并将其平滑设置为 true ...这是 Flex 的一个大缺陷,有时它需要类来进行样式设置,尽管一些IDisplayObjectFactory
完全足以满足该目的,并且会让您的生活变得更加轻松......但生活就是生活......不要'不知道一个干净的Flex唯一方法...我能想到的唯一可能性是创建一个SWF,其中包含您的资源作为符号,打开平滑功能,并从该SWF中嵌入该符号...
希望帮助...
问候
back2dos
a hacky way would be to traverse the children/grandchildren of the button, to find the corresponding
Bitmap
that is of typec_deleteButton_styleUp
, and set its smoothing to true ... it is a big flaw of flex, that sometimes it requires classes for styling although someIDisplayObjectFactory
would completely suffice for that purpose and would make your life a lot easier ... but life is life ...don't know of a clean flex only way ... the only possibility i could think of, is to create an SWF, that contains your asset as a symbol, with smoothing turned on, and embed this symbol from that SWF ...
hope that helps ...
greetz
back2dos
更好、更通用的解决方案。 它不仅可以处理上述情况,而且
A better, more general solution. Not only does it handle the above case, but it does it
愚蠢,但它有效。
Silly, but it works.
我不知道你们是因为什么而撞头的无意冒犯,只是开玩笑。 我有一张桌子 :-P
无论如何,提供的那些脚本完全没用! 一方面,您无法将 uicomponent 转换为位图! 另一件事是,带有 rawchildren 的秒脚本或多或少相同。 rawchildren 获取您的孩子和容器的铬 - 就是这样。 如果容器中有一个按钮,您可以尝试平滑容器的镶边 - 其余部分保持不变,因为所有转换为位图都会失败。
那么,有人rdfm吗?
另一方面。 人们可以尝试 stage.quality 到 stagequality.best。 如果您查看 adobe 论坛http://forums.adobe.com/thread/427899,您会看到flex运行良好 - 只是空气有点忽略这一点:-(
如果这两个脚本曾经工作过 - 特别是带有按钮作为位图的部分 - 我会去某个地方砸碎我的头:-)。 我在类层次结构中看不到这可行的方法。 毕竟, numChildren 只为您提供 uicomponents 或 displayobjects,仅此而已!
I do not know what you folks banged your head on no offense, just joking. I had a desk :-P
Anyway, those scripts presented are totally useless! For one thing you cannot cast a uicomponent to bitmap! The other thing is, that the seconds script with rawchildren ist more ore less the same. rawchildren gets your the children and the chrome of the container - that's it. If you have a button in a container you can try to smooth the chrome of the container - the rest stays the same since all casts to bitmap will fail.
So, did anyon rdfm?
On the other hand. One could try out stage.quality to stagequality.best. If you check the adobe forums http://forums.adobe.com/thread/427899 you will see that flex runs well - just air kind of ignores this :-(
If those two scripts ever worked - esp. the part with button as bitmap - I'll go and smash my head somewhere :-). I see NO WAY in the class hierarchy that this could work. After all, numChildren only gives you uicomponents or displayobjects but nothing more!