Flash脚本-创建重复的动画片段

Download the sample files here.

在此处下载示例文件

Note that this tutorial assumes that you know how to create buttons and text fields.

请注意,本教程假定您知道如何创建按钮和文本字段。

1. First, create a button and label it "make clones".

1.首先,创建一个按钮并将其标记为“ make clones”。

2. Create a text field as shown in the above movie. Give it a variable name "no_clones".

2.创建一个文本字段,如以上电影所示。 给它一个变量名“ no_clones”。

3. Create a movie clip of your choice, which we can duplicate. I created a circle object with a gradient.

3.创建您选择的影片剪辑,我们可以将其复制。 我创建了一个带有渐变的圆形对象。

4. Give the movie clip an instance name of "clone".

4.为影片剪辑指定实例名称“ clone”。

5. Now, in the default layer’s first key frame, insert this action:

5.现在,在默认层的第一个关键帧中,插入以下操作:

// set variable clips=value in text field.
clips = no_clones;

6. Right click the button and insert these actions:

6.右键单击按钮并插入以下操作:

/on (release)
{
// get the current x pos of the clone movie
mov_x = getProperty("/clone",_x);
//Check if the text field is empty if empty set it to 1
if(no_clones == "")
{
no_clones = 1;
}
// Use for loop to remove existing movie clip
for(i=1; i<=clips; i=i+1)
{
removeMovieClip ("/clone" add i);
}
// Use for loop to create duplicate movies.
for (i=1; i<=no_clones; i=i+1)
{
mov_x = mov_x + 50;
duplicateMovieClip ("/clone", "clone" add i, i);
setProperty ("/clone" add i, _x, mov_x);
}
//set variable clips = no_clones.
clips = no_clones;
}

I’ve commented the above script so that it’s easier for you understand. But that’s all you need to do: it’s time to test the movie.

我评论了上面的脚本,以便您更容易理解。 但这就是您所要做的:现在是测试电影的时候了。

Learning to create duplicate movie clips in flash is very usefull. It can be used to create a lot of effects — happy experimenting!

学习在Flash中创建重复的影片剪辑非常有用。 它可以用来创建很多效果-尝试愉快!

翻译自: https://www.sitepoint.com/create-duplicate-movieclips/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值