影片剪辑动态变量的属性?

发布于 2024-12-25 19:06:58 字数 328 浏览 3 评论 0原文

我偶尔会使用 flash.display.MovieClip 类的这个有用的属性,

例如:

var mc:MovieClip = new MovieClip();
mc["myVariable"] = myAnotherMovieClip;
mc["myVariable2"] = true;
mc["myVariable3"] = new Array(0,0,1);

嗯,我想了解有关 movieclip 的这个“功能”的更多信息。我从一位同事那里了解到这一点,但并不真正知道这在 AS3 中被称为什么。

如果你们能提供帮助,我会非常高兴。

I do occasionally use this useful property of the flash.display.MovieClip class

for eg:

var mc:MovieClip = new MovieClip();
mc["myVariable"] = myAnotherMovieClip;
mc["myVariable2"] = true;
mc["myVariable3"] = new Array(0,0,1);

Well, I'd like to learn more about this 'feature' of movieclip. As I got to know this from a colleague and do not really know as to what this is called in AS3.

I'd be really glad if you people could help.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

待天淡蓝洁白时 2025-01-01 19:06:58

在AS3中,MovieClip类是一个动态类。更多信息请参见:http://help.adobe.com /en_US/FlashPlatform/reference/actionscript/3/statements.html#dynamic

In AS3, the MovieClip class is a dynamic class. More informations here: http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/statements.html#dynamic

甜中书 2025-01-01 19:06:58

影片剪辑类是一个动态对象,它可以保存不同类型的变量(属性)。方括号是动态设置和访问对象属性的一种方式。

trace(mc["myVariable2"]) 将输出 true

trace(mc.myVariable2) 也会输出 true

请注意,mc["myVariable"] = myAnotherMovieClip 将创建一个属性来存储对 myAnotherMovieClip 的引用。

The movie clip class is a dynamic object and it can hold different types of variables (properties). Square brackets are a way of dynamically setting and accessing the properties of an object.

trace(mc["myVariable2"]) would output true;

trace(mc.myVariable2) would output true as well.

Note that mc["myVariable"] = myAnotherMovieClip would create a property that stores the reference to myAnotherMovieClip.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文