Flash AS3 - Inaccessible Method
January 9, 2013 8:49 AM Subscribe
Why is this method inaccessible?
My document class (Main) has a public function setButtonStates(). I have a custom class that extends MovieClip that needs to access that function. There are 5 instances of this class on the stage at compile-time (and they are never removed) but the compiler isn't happy. It says "1195 Attempted access of inaccessible method setButtonStates through a reference with static type Main".
posted by missmagenta to Computers & Internet (12 answers total)
Basically, what I'm working on is an undo button. I have 3 classes that perform "undoable" actions. When they push an operation to the undo stack the undo/redo buttons need to be refreshed to reflect that there is now something to undo/redo. Unfortunately none of the 3 classes seem to be able to access the function. They are able to run the code in the function but I'd rather not have to copy the code 3 times.
I've been through 2 pages of google results and every time the solution was that the function was private (mine was originally but I changed it to public) or the function was a getter/setter.
(also, bonus points if you tell me why root["property"] is ok and Main(root).property is ok but root.property causes a compile error and also why root["property"] doesn't work when root["instance_of_item_on_stage"].parent["property"] works. )