The first line of this code is throwing ReferenceError #1069. "Property focusMask not found on ObjectButtonSkin and there is no default value." The "skin" variable is of type MovieClip, and the actual object instance is of type ObjectButtonSkin (which extends MovieClip).
if (skin["focusMask"] != null)
if (skin["focusMask"] is DisplayObject)
(skin["focusMask"] as DisplayObject).visible = false;
This was never a problem before, so I'm not sure why this is happening. The ObjectButtonSkin class is not marked as dynamic or anything else, so perhaps that's the problem? One site suggested I should be using "()" instead of "[]" to access the property开发者_运维百科, but that doesn't seem right.
A better check for the existence of focusMask would be:
if (skin.hasOwnProperty("focusMask") && skin.focusMask!=null)...
Or, if you want to be cleaner, you should extract the focusMask to a variable:
var focusMask:DisplayObject = skin.getChildByName("focusMask");
if (focusMask)
focusMask.visible = false;
精彩评论