我怎样才能获得使用任何影片剪辑的功能?

How can i get a function to use any movie clip?

我有点迷失在理解这种功能上,我感觉这个问题已经被问过一千次了,但找不到代码在做什么的解释。

基本上我只是想要一个带有实例名称框的影片剪辑来做一些事情,然后在其他影片剪辑中重用该功能

有点像这样,但有效。

非常感谢

//my function to be used on "instance name" box
myfunc (box);

function myfunc ();
{
    while (this is happening);
    {
    //in this case box.x = goes where ever i put it
    .x = goes here
    .y = goes here
    }
}

抱歉,这不是英语,我的沟通能力很糟糕

当然可以。你给函数一个参数,然后引用一个参数来改变它的属性。通过这样一个简单的移动函数,它可以接受 DisplayObject - MovieClip 的远距离超类,因此可以接受 Flash 可以显示的那些对象的许多其他可能 类 的超类。

function myfunc(param:DisplayObject):void {
    // no semicolon after declaring the function!
    while (somethingIsHappening(param)) {
        // why not call a query on that object?
        param.x+=1; // move right by 1 pixel
    }
}

您可能需要查看有关 ActionScript 3 语法的 this manual,以及有关变量、函数和 类 的后续页面,以了解更多信息。