当 DisplayObject 在特定区域移动时,如何更改其颜色?
我正在使用 Flex 编写图形界面,并且有一个与 Flash 中的蒙版相关的问题。
我想创建一种遮罩,它根据文本在屏幕上的位置定义文本将具有哪种颜色和哪个 alpha 值。例如,使用文本作为位图的掩码就可以很容易地做到这一点。
但是,我还想考虑文本本身的颜色。
例如,如果我创建一个红色文本,在某些区域中它将是带有修改后的 alpha 值的红色,但在另一个区域上,文本将是全白色,就好像有一种蒙版也将其自己的颜色应用于其顶部。
有没有一种方法可以轻松地完成这种事情?
当然,我可以根据文本的位置手动应用格式,但我想知道是否有自动处理,例如使用 DisplayObject 作为处理模式的遮罩或混合模式。
谢谢你!
I am coding a graphical interface using Flex, and I have a qestion related to masks in Flash.
I want to create a kind of mask that defines which color and which alpha value a text will have according to its position on the screen. It is very easy to do that with the text being the mask of a bitmap, for instance.
However, I also want to take into account the color of the text itself.
For instance, if I create a red text, in some zone it will be red with a modified alpha value, but on another zone, the text will be full white, as if there was a kind of mask which also applies its own color on top of it.
Is there a way to easily do this kind of thing?
Of course, I can manually apply the format on the text according to where it is, but I wonder if there is an automatic processing like mask or blend mode using a DisplayObject as a processing pattern.
Thank you!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
就我个人而言,我会在组件中设置改变颜色的状态,并且当组件滚动到“部分”时能够设置这些状态。
Personally, I would have states in my component that changes color, and have something be able to set those when your component rolls over your 'section'.