更改填充影片剪辑的ActionScript 3的颜色 [英] Changing fill color of MovieClip Actionscript 3

查看:253
本文介绍了更改填充影片剪辑的ActionScript 3的颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要问,怎么只改变填充实例的色彩在舞台上 - 我可以通过使用ColorTransform对象做到这一点,但它会改变颜色的整体情况,而不仅仅是填充。我想只改变填充颜色,不是笔触颜色。任何人可以帮助我吗?

这是我的code:

 功能涂料(){
    VAR myColorTransform的:的ColorTransform =新的ColorTransform();

    myColorTransform.color = someColorNumber;

    coloredObject.transform.colorTransform = myColorTransform的;

}
 

解决方案

这不能做,一旦你已经开出的形状,动作脚本无法确定什么是中风的,什么是填充。

您有几个选项。

您的填充和笔触分离成单独的影片剪辑并设置颜色变换只适用于补。

如果这是一个简单的形状,使用图形对象,您可以指定填充颜色和笔触颜色画出来。

可能的引擎盖,和我的preferred方法,将是第一个选项的形状很可能是复杂的,留在FLA给出了一个设计师能够改变它,而不是开发者更大的控制权。这是一个多一点的工作,但并稍微复杂一些。

i want to ask, how to change only fill color of an instance on the stage - i can do it by using ColorTransform object, but it changes color of the whole instance, not just the fill. I want to change only the fill color, not the stroke color. can anybody help me?

this is my code:

function paint(){
    var myColorTransform:ColorTransform = new ColorTransform();

    myColorTransform.color = someColorNumber;

    coloredObject.transform.colorTransform = myColorTransform;

}

解决方案

This cant be done once you've drawn a shape as action script has no way of determining what is a stroke and what is a fill.

You have a couple of options.

Separate your fill and stroke into separate movie clips and set the color transform to only apply to the fill.

or

If it's a simple shape, draw it using the Graphics object where you can specify fill colours and stroke colours.

Likely hood is, and my preferred method, would be the first options as the shape is likely to be complex and leaving it in the fla gives greater control for a designer being able to change it rather than a developer. It's a little more work though and slightly more complex.

这篇关于更改填充影片剪辑的ActionScript 3的颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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