使用 ActionScript 3 在 Flash 中排列 (z) 对象的顺序? [英] Arrange (z) order of objects in Flash with ActionScript 3?

查看:30
本文介绍了使用 ActionScript 3 在 Flash 中排列 (z) 对象的顺序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用 ActionScript 3 在 Flash 中排列 (z) 个对象的顺序?

Is it possible to arrange (z) order of objects in Flash with ActionScript 3?

例如我在给定的图层上有 3 个符号实例,我想执行相当于带到前面"、向前"和/或定位某个 z 位置的操作.

e.g. I have 3 symbol instances on a given layer, and I want to perform the equivalent of 'Bring to Front', 'Bring Forward', and/or target a certain z position.

推荐答案

您可以使用这样的动作脚本更改同一层内影片剪辑的 z-index(堆叠顺序).

You can change the z-index (stacking order) of a movie clip within a same layer using action script like this.

parent.setChildIndex(childObject, i)

将 childObject 更改为要更改 z-index 的影片剪辑的名称,将 i 更改为整数(所需的 z-index 值).

Change childObject to the name of the movie clip you want to change the z-index, change i to an integer (the desired z-index value).

如果您想在鼠标事件上实现这一点,请将上述代码放在一个函数中,并将事件侦听器附加到按钮上,以便在鼠标事件上调用此函数.

If you want to make this happen on a mouse event, put above code inside a function and attach an event listener to a button to invoke this function on a mouse event.

这篇关于使用 ActionScript 3 在 Flash 中排列 (z) 对象的顺序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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