This content has been marked as final. Show 4 replies
Same thing. When I trace it, it returns TRUE, so the value does get set normally. It just doesn't draw the checkmark on the screen.
The problem is most likely that all the children of the movieclip aren't immediately available when you attach the clip. All the variables and objects on the main timeline of the movieclip are available, but the children objects aren't available until one frame has passed.
If you try and trace the mc.chk.selected value without assigning it, you will see that it is undefined because until one frame has gone by nothing is defined in the child.
By setting it to true you are creating a value for that one frame before it is defined. But as soon as the checkbox's code runs it will replace it with its default value of false. You can see this if you add this to the end of your code:
First the code outside the onEnterFrame will execute and show the value "true" and then it will repeat with "false." In fact since the first time you are setting it there is no reason it even needs to be a Boolean. You can say:
And it will "work." The only think I know to do is to cheat.
mc.chk.selected = true;
There is also a component.doLater() method that you might think will work. But again the checkbox inside the clip doesn't yet know that it is a component so you can't use a component method on it until after one frame.