为什么Flash CS3要求您在导出actionscript(as3)时指定基类?

时间:2021-04-30 18:55:48

In the library, right-click on a movieclip that you have written an ActionScript class for and select "Linkage...". Notice that the "Base class" field is not empty (it can't be). It's likely to be flash.display.MovieClip, but it could be something else, depending on what your class inherits from. This base class field is only required when publishing for ActionScript 3.

在库中,右键单击已编写ActionScript类的动画片段,然后选择“Linkage ...”。请注意,“基类”字段不为空(不能为空)。它可能是flash.display.MovieClip,但它可能是其他东西,具体取决于你的类继承的内容。只有在为ActionScript 3发布时才需要此基类字段。

So can anyone tell me why Flash CS3 insists on me providing the base class in both the ActionScript file and the Linkage dialog? If the base class differs between the two locations, it can still be published without errors, and the Linkage dialog just seems to be ignored (as long as it's valid).

那么有谁能告诉我为什么Flash CS3坚持要求我在ActionScript文件和Linkage对话框中提供基类?如果两个位置之间的基类不同,它仍然可以无错误地发布,并且似乎忽略了链接对话框(只要它有效)。

What is the point of the Base class field!?

基类字段有什么意义!?

3 个解决方案

#1


2  

I often use it so set the same base class for multiple objects without creating separate class .as files for them. It's useful when you're doing more graphical type stuff and don't really need separate classes, but do need to create them programatically.

我经常使用它,因此为多个对象设置相同的基类,而不为它们创建单独的类.as文件。当你做更多的图形类型的东西并且不需要单独的类时,它是有用的,但是需要以编程方式创建它们。

I don't know why it allows you to set incorrect parameters here, I suspect it's an heritage from the very "relaxed view" on typing the Flash IDE always had.

我不知道为什么它允许你在这里设置不正确的参数,我怀疑它是从非常“轻松的视图”输入Flash IDE总是有的遗产。

#2


1  

From: http://www.adobe.com/devnet/flash/quickstart/external_files_as3/

The value of the Base Class defaults to flash.display.MovieClip. Use this default unless you are using an automatically generated class that uses the functionality of an external class. Base Class is not synonomous with extension; if you are specifying a custom class that itself extends another class, it is not necessary to specify this superclass as the Base Class. In this situation, the default of flash.display.MovieClip is sufficient. If, however, you wanted two symbols, RedFish and BlueFish, to function identically but have different skins, you could use the authoring tool to create different appearances, then set their Base Class to Fish and use a Fish class in an external Fish.as file to provide the functionality for both fish.

基类的值默认为flash.display.MovieClip。除非您使用的是使用外部类功能的自动生成的类,否则请使用此默认值。基类不与扩展同义;如果要指定自身扩展另一个类的自定义类,则不必将此超类指定为基类。在这种情况下,flash.display.MovieClip的默认值就足够了。但是,如果你想两个符号,红鱼和青鱼,以相同的功能,但具有不同的外观,您可以使用编辑工具来创建不同的外观,然后设置其基类鱼和外部Fish.as使用鱼类文件以提供两种鱼的功能。

#3


0  

Well, it can be a Button, a Sprite, MovieClip, or any other display object. You are simply creating a special version of one of these. You need to provide Flash with the type you are creating.

好吧,它可以是Button,Sprite,MovieClip或任何其他显示对象。您只是创建其中一个的特殊版本。您需要为Flash提供您正在创建的类型。

#1


2  

I often use it so set the same base class for multiple objects without creating separate class .as files for them. It's useful when you're doing more graphical type stuff and don't really need separate classes, but do need to create them programatically.

我经常使用它,因此为多个对象设置相同的基类,而不为它们创建单独的类.as文件。当你做更多的图形类型的东西并且不需要单独的类时,它是有用的,但是需要以编程方式创建它们。

I don't know why it allows you to set incorrect parameters here, I suspect it's an heritage from the very "relaxed view" on typing the Flash IDE always had.

我不知道为什么它允许你在这里设置不正确的参数,我怀疑它是从非常“轻松的视图”输入Flash IDE总是有的遗产。

#2


1  

From: http://www.adobe.com/devnet/flash/quickstart/external_files_as3/

The value of the Base Class defaults to flash.display.MovieClip. Use this default unless you are using an automatically generated class that uses the functionality of an external class. Base Class is not synonomous with extension; if you are specifying a custom class that itself extends another class, it is not necessary to specify this superclass as the Base Class. In this situation, the default of flash.display.MovieClip is sufficient. If, however, you wanted two symbols, RedFish and BlueFish, to function identically but have different skins, you could use the authoring tool to create different appearances, then set their Base Class to Fish and use a Fish class in an external Fish.as file to provide the functionality for both fish.

基类的值默认为flash.display.MovieClip。除非您使用的是使用外部类功能的自动生成的类,否则请使用此默认值。基类不与扩展同义;如果要指定自身扩展另一个类的自定义类,则不必将此超类指定为基类。在这种情况下,flash.display.MovieClip的默认值就足够了。但是,如果你想两个符号,红鱼和青鱼,以相同的功能,但具有不同的外观,您可以使用编辑工具来创建不同的外观,然后设置其基类鱼和外部Fish.as使用鱼类文件以提供两种鱼的功能。

#3


0  

Well, it can be a Button, a Sprite, MovieClip, or any other display object. You are simply creating a special version of one of these. You need to provide Flash with the type you are creating.

好吧,它可以是Button,Sprite,MovieClip或任何其他显示对象。您只是创建其中一个的特殊版本。您需要为Flash提供您正在创建的类型。