For example, I have a hierarchy of video clips. mc1 is a child of mc, and mc2 is a child of mc1. It turns out when I install
mc1.visible = false;
mc2.visible remains true.
Is this supposed to happen? Is there a shortcut to check mc2 visibility?
Code to play:
var mc = new Sprite(); mc.graphics.beginFill(0xFF0000); mc.graphics.moveTo(50,50); mc.graphics.lineTo(100,50); mc.graphics.lineTo(100,100); mc.graphics.lineTo(50,100); mc.graphics.endFill(); var mc1 = new Sprite(); mc1.graphics.beginFill(0x00ff00); mc1.graphics.moveTo(150,150); mc1.graphics.lineTo(200,150); mc1.graphics.lineTo(200,200); mc1.graphics.lineTo(150,200); mc1.graphics.endFill(); mc.addChild(mc1); var mc2= new Sprite(); mc2.graphics.beginFill(0x0000ff); mc2.graphics.moveTo(250,150); mc2.graphics.lineTo(200,150); mc2.graphics.lineTo(200,200); mc2.graphics.lineTo(250,200); mc2.graphics.endFill(); mc1.addChild(mc2); stage.addChild(mc); mc1.visible = false; function myOnEnterFrame(e){ trace(mc2.hitTestPoint(mouseX, mouseY)); } stage.addEventListener(Event.ENTER_FRAME, myOnEnterFrame);
Results: mc2.visible will still be true. hitTest will still fire for mc2.
Is there any other way to test the presence of mc2 on stage, other than reprising the role of parents?
clorz source share