Question

I have two MovieClip symbols in my library and I want them to share the same class, but Flash doesn't allow me to assign the same class to any two different MC symbols, so instead I created two bogus classes which extend the class I wished to share initially.

So having two MC symbols defined by 2 different classes extending a different class allows me to share the same piece of code.

My Question: is there a better was to share a class between 2 or more different library symbols?

Was it helpful?

Solution

Whatever you're doing, you don't understand the concept of "using" a class associated with a movie clip object. It is impossible for you to assign the same class name to both objects and even if you are, believe me the IDE is actually creating two different objects which extend the original class. You can assign a library item directly to a class, or you can define a new class name which EXTENDS the .as file/class you're referencing as the base class. The latter is the solution intended for simply applying a base class with base-functionality to several objects.

An example of this would be to define a basic class that catches roll over and roll out events and makes the clip grow and shrink on roll in/out. You then make 10 different types of buttons in your movieclip and assign the class you made as the base class, while giving a unique name to the library object itself.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top