Question

I have a Movie Clip, lets call it A. Then inside A, i have another Movie Clip, lets call it B, then inside B, I have another Movie Clip , lets call it C, and inside C I have a several button that needs to be disabled temporarily. Is it possible? I have tried

A.B.C.enabled=false;

and

A.B.C.mouseEnabled=false;

That's not working. However i found a way to do it.

A.B.C.buttonInsideC.mouseEnabled=false;

But if I use it like that, I have to script it for all of the button, and I have a lot. So I think that would be a burden to my program.

Was it helpful?

Solution

Not only mouseEnabled, you have to disable mouseChildren property of C too.

A.B.C.mouseChildren = false;

OTHER TIPS

I assume you already have a custom class to store your child MovieClip in, just have a function that checks if it is the correct child and if it isn't call the same function on the child. EG:

public class ClipMovie extends MovieClip
{
    private var _Child:ClipMovie;

    public function DisableButtonsAt(int childIndex, int currentIndex):void
    {
            if(childIndex + 1 == currentIndex)
            {
                someButton.mouseEnabled = false;
            }
            else if(_Child != null)
            {
                _Child.DisableButtonsAt(childIndex, currentIndex + 1);
            }
            else
            {
                throw new Error("Unable to find child, cannot disable buttons.");
            }
    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top