Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Subclass of Button component forces reference of Inspectable in superclass

New Here ,
May 07, 2014 May 07, 2014

Hi,

I have a subclass of the Button component and I created a function that overrides the addEventListener public function.  This requires a variable for checking the type of event being added to add extra listeners.  As this is a component I wish to have the Inspectable give the user the option to switch this off so I added a Boolean to do so.

However I get a type 1119 error (Symbol 'MainMenu', Layer 'buttons', Frame 1    1119: Access of possibly undefined property forceButtonEvents through a reference with static type Button.).

If I add the private/public variable to the Button class then the component properties work fine with no error.  If I do not then it throws the error.  If I hardcode the variable and do not use an inspectable then everything works fine.

My issue is that I do not wish to edit the superclass.  I have other component extends that use inspectables just fine without references in the superclass but for some reason this Button class seems to throw this error.

Is there any way to define a variable in the superclass via the subclass (I presume not) or is there any reason why the Inspectable does not allow me to go without a reference in the superclass?

Any help is much appreciated.

Regards

Marc

TOPICS
ActionScript
344
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2014 May 08, 2014

I did some more testing with this and it seems the Button component cannot be subclassed with Inspectables without referencing their conjoined variables in the superclass.  Im not entirely sure why but any workaround would be appreciated.

Currently my workaround is to not have inspectables in the subclass of the button component.  A dire workaround for a component but at least I have a public variable I can set.   Shame I really wanted that component property.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 08, 2014 May 08, 2014

This guy figured sth. out, which you can probably use as a hint:

Attaching Data to a Button by Subclassing the ActionScript 3 Button Class

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 08, 2014 May 08, 2014
LATEST

maybe amisunderstanding here but I dont have a problem with the function I have created.  I simply did an override of the addEventListener function and parsed inside it, which worked like it should.

My problem is that when I want to have a simple enable/disable Inspectable variable for the Component Property window in the IDE.  It is forcing me to reference the variable in the superclass.  This happens regardless of the function override and happens whenever I add an inspectable metatag.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines