Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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
Copy link to clipboard
Copied
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.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now