一个概念类似于AS3指针? [英] a concept similar to pointers in as3?
问题描述
是否有指针的一个概念或任何类似于AS3?
Is there a concept of pointers or anything similar to that in as3?
我已经使用的概念
var mc1:MovieClip;
var mc2:MovieClip();
var mcCommon:MovieClip = new MovieClip();
mcCommon["myptr"] = mc1;
mcCommon["myptr"] = mc2;
我会在哪里去阅读和了解更多关于这个概念。我想获得简单的答案,因为我不是在AS3的专家。我仍然在学习。
Where would I get to read and learn more about this concept. I'd like to get simple answers, as I am not an expert in as3. I'm still learning.
推荐答案
如果你特别问的是code,首先它应该是这样的:
If you are asking specifically about the code, first of all it should look like this:
var mc1:MovieClip;
var mc2:MovieClip;
var mcCommon:MovieClip = new MovieClip();
mcCommon["myptr"] = mc1;
mcCommon["myptr"] = mc2;
虽然两个MC1和MC2实际上是空。
Though both mc1 and mc2 are actually null.
语法mcCommon [myptr]是指您创建一个名为myptr的影片剪辑mcCommon财产。所以,你可以在以后检索该属性的使用mcCommon [myptr]的内容。最后一行实际上将覆盖该属性的内容(如果它不是空,当然)。你可以这样做,因为MovieClip类是动态的。在其他(非动态)情况下,你不能像这样创建的属性。
The syntax mcCommon["myptr"] means that you create a property named "myptr" on MovieClip mcCommon. So you can later retrieve the content of this property using mcCommon["myptr"]. The last line actually overwrites the content of the property (if it wasn't null of course). You can do that because MovieClip class is dynamic. On other (non-dynamic) instances you can't create properties like this.
这篇关于一个概念类似于AS3指针?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!