如何使用ActionScript 3使用两个.as文件在Flash?如何使用、两个、文件、Flash

2023-09-08 15:26:31 作者:软妹界大佬

我只能指定一个。如文件,我怎么能在这2个班?

I can only specify a single .as file,how can I have 2 classes in it?

推荐答案

该文件(在你的情况,它的MinPlay)指定称为文档类。

The file (In your case, its MinPlay) you specify is called the document class.

在这些文件中的内容,该文件应该有一个类名为MinPlay延伸无论是Sprite或MovieClip类。类似于

Among the contents in the file, the file is supposed to have class a class named 'MinPlay' which extends either a Sprite or Movieclip. Something like

package 
{   
  public class MinPlay extends Sprite
     {
     // Constructor??
     }
}       

因此​​,基本上,当你在文档类的上述类型的构造函数将被调用。这是完全由你来初始化新类,添加事件侦听器或做任何你喜欢从这里开始。您可以创建任意数量的类文件(如文件)及它们连接在一起,它的直前言OOP从这里开始。

So basically when you type in the document class as above, the constructor will be called. It is totally up to you to initialize new classes, add event listeners or do whatever you like from here on. You may create any number of class files (as files) & link them all together, it's straight foreward OOP from here on.

关于你的问题。好了这件事,认为每一个编程语言都需要有一个单一的入口点,这在闪光灯的情况下是文档类。闪光的目的是做什么,你就已经与动作做的,或者说写code为您服务。因此,文档类是一样的东西说:让我继续在这里。

About your question. Well about that, consider that every programming language needs to have a single entry point, which in the case of flash is the document class. Flash is designed to do what you would already do with actionscript, or rather write code for you. So document class is something like saying "let me carry on from here".