开发者

Explanation of Base Class (Flash) and inheritance

开发者 https://www.devze.com 2023-04-09 23:53 出处:网络
I have a MovieClip called PopUp 开发者_高级运维where I wrote some code. I need to make another MovieClip that uses pretty much the same code...can I just use the PopUp class as the base class for my

I have a MovieClip called PopUp 开发者_高级运维where I wrote some code.

I need to make another MovieClip that uses pretty much the same code...can I just use the PopUp class as the base class for my other MovieClip?

They look different but they have the same instances on the stage and stuff.


You can just create a new class called PopUpBase, and let your new MC's extend that class. Generally changing the base class in the IDE can cause some problems, so it's best practice not to, but to create classes (and .as files) for each MC that needs code.

Depending on what you're doing with this, it might be okay just to change the base classes to PopUpBase (in the IDE) :)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号