flash 渐变遮罩_Flash脚本-Flash MX中的动态遮罩

flash 渐变遮罩

With Flash Mx comes dynamic masking capability! Now you can mask objects using action script. In this small tutorial I’ll show you how to use the setMask method to mask an object.

带有Flash Mx的动态遮罩功能! 现在,您可以使用动作脚本屏蔽对象。 在这个小型教程中,我将向您展示如何使用setMask方法掩盖对象。

Download the sample files here.

在此处下载示例文件

方向 (Directions)

1. Create a new movie.

1.制作新电影。

2. Import two images into Flash. I have used images of a rooster and a tiger.

2.将两个图像导入Flash。 我用过一只公鸡和一只老虎的图像。

3. Convert the images to movieclips.

3.将图像转换为电影剪辑。

4. Give both the movieclips instance names.

4.给出两个动画片段实例名称。

5. Now, create the masking object — in this case, I’ve used a small circular object.

5.现在,创建遮罩对象-在这种情况下,我使用了一个小的圆形对象。

6. Convert the circular object into a movie clip, and give it an instance name of "circle".

6.将圆形对象转换为影片剪辑,并为其指定实例名称“ circle”。

7. Create three buttons: one to mask the tiger image, another to mask the rooster image, and the third to remove masking.

7.创建三个按钮:一个用于遮盖老虎图像,另一个用于遮盖公鸡图像,第三个按钮删除遮盖。

8. Give the buttons instance names. Before I insert actionscript for the buttons, give them instance names: I gave mine the names of "left","right" and "remove".

8.给按钮实例名称。 在为按钮插入动作脚本之前,给它们指定实例名称:我给我命名了“左”,“右”和“删除”。

9. Enter the following code. Select the first frame of the current layer, press f9 to open the actions window, and enter the following actions:

9.输入以下代码。 选择当前层的第一帧,按f9键打开操作窗口,然后输入以下操作:

left.onPress = function()
{
 rooster.setMask(null);
 tiger.setMask(circle);
}
right.onPress = function()
{
 tiger.setMask(null);
 rooster.setMask(circle);
}
remove.onPress = function()
{
 rooster.setMask(null);
 tiger.setMask(null);
}

10. That’s it! Test the movie.

10.就是这样! 测试电影。

翻译自: https://www.sitepoint.com/dynamic-masking-flash-mx/

flash 渐变遮罩

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值