Why does Flash CS3 require you to specify the base class when exporting for actionscript (as3)?

这一生的挚爱 提交于 2019-12-14 04:06:46

问题


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.

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).

What is the point of the Base class field!?


回答1:


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.

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.




回答2:


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.




回答3:


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.



来源:https://stackoverflow.com/questions/277073/why-does-flash-cs3-require-you-to-specify-the-base-class-when-exporting-for-acti

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!