This content has been marked as final. Show 5 replies
if you're trying to create a toggle effect use:
kglad - That's cool! It works great. I put it right inside box_mc and left out all the "box_mc"s in the code.
How does "this.toggle=!this.toggle" ? "toggle equals NOT toggle"??? Is "toggle" a reserved word or something?
no, toggle is a simple author-defined boolean variable. like all booleans:
simply changes the value from true to false or from false to true. ie, it alternates between those booleans and can be used for toggling.
The toggle Saga continues.
I've used the toggle code you provided successfully in the mc described earlier.... "It has 4 states, up, over, down and hold...10 frames apart on the timeline." I put the toggle code on the first frame of that mc and named it box_mc. If I drag an instance on the stage it works great.
To make use of this multiple times I nested box_mc into other movie clips and added a layer for the specific "button label" text (tools, links, topics, etc). So now I have box_mc inside the mc named btn_tools.
I'm applying an onRelease to btn_tools to trigger some other stuff moving on the stage (toolsView). But
I can either get the states of box_mc OR the action that's supposed to happen onRelease. Naturally I want both. See the first 2 snippets.
To continue with this mess I cut out the nesting part and just duplicated box_mc, renamed it mc_tools, added a layer to it , put the "button label" text on that layer and tried to address mc_tools on the stage. Remember that the toggle code is on frame 1 of of this now. When I use the third snippet below - I get the pretty "over" , "hold" states but not toolsView on the stage.
How can I get the results I want?
Thanks for your help.
if you apply mouse handlers to a parent and to a child movieclip the child movieclip will not respond to mouse events because the parent movieclip intercepts those events.
to remedy, you must either code all mouse handlers on the child generation all use a hitTest() (instead of mouse handlers) for the parent or child.