0

I am using Flash CS6 and I am stuck by the inherited definitions.

Suppose I have a class named Button such as:

public class Button extends MovieClip
{
    public var _text : TextField;
}

In the Library I would like to create a MovieClip symbol, export it to actionscript and set the 'class' to 'ButtonSkinned' and the 'base class' to 'Button'. Inside this MovieClip symbol I put a text field with the name '_text' on the stage.

It is a traditional way to define a customized MovieClip and do the skinning, am I right?

There the problem comes:

If I use the class 'Button' by adding it to my class path everything is OK.

If I pre-compiled this class into a SWC file and add it as an External library. When I was exporting the SWF, Flash CS6 throw out an error:

Symbol 'ButtonSkinned' A conflict exists with inherited definition MyPackage:Button._text in namespace public.

Of course I have disabled the 'Automatically declare stage instances'. I have no idea how to get rid of this error. Any solution about this?

jayatubi
  • 1,972
  • 1
  • 21
  • 51

2 Answers2

0

If you are extending a non-dynamic class with public variables, you do not need to redeclare them, and yes, in this case you even cannot redefine such a variable. "Protected" and "public" variables are available to both the superclass and the subclass. In short, do not declare public var _text in ButtonSkinned class, the definition in Button is enough.

Vesper
  • 18,599
  • 6
  • 39
  • 61
  • I didn't manually write the class 'ButtonSkinned'. I just set the 'Class' to 'ButtonSkinned' in the symbol's property. Flash was going to automatically generate the code. However, that seems the code Flash generated may duplicate the definition of '_text' because there is a text field with the name on the stage but actually I have already disabled the 'Automatically declare stage instances'. – jayatubi Apr 17 '13 at 11:45
0

I found the same case and a walk around here: http://forums.adobe.com/thread/198821

The key to walk around is manually write the visual symbol associated class code instead of auto generate by Flash. To make it more easy to use a JSFL script to auto write the class code would be great helpful.

jayatubi
  • 1,972
  • 1
  • 21
  • 51