I'm attaching movieClips to a parent movieClip, and I'm incrementing the depth at which the movieClips are attached. When I try to use the rollOver methods of the children movie classes, they are unresponsive. I know that they're being correctly set, because when I execute a call to _level0.parentClip.childClip.onRollOver();, the function works as I would like it to. How do I get rollOver to work like this?
Does anyone know if onRollOver works with attached movie clips? I've tried everything I can think of, and the method is being set for all the child movieClips, but isn't getting called when I roll my mouse over. Anyone?
Does this help? my_mc.onRollOver = function(){ Do whatever you want
if your path to your attach movieclips is correct, then you probably have mouse handlers attached to the parent movieclip which are intercepting the mouse events. to remedy use a hitTest(), mouse position detection or define all your mouse handlers for the youngest generation that needs a handler.
Unfortunately, no. The thing that I'm finding is that a parent movie clip's event handlers override all the children's event handlers. My current idea is to find a way to temporarily delete the event handlers for the parent while the children's event handlers need to work. For some specifics, I have a drawApp component that I've written, and effectively what it does is it allows you to drag and drop a pallette for drawing onto the stage. All the subsequent brushstrokes are attached to that component. The constraints of the project are now such that a simple "undo last series of brushstrokes" function will not suffice, and an erase function is necessary. I figure it will be more effective and efficient to use Flash's built-in rollOver event handler to detemine when the mouse is over the brushstrokes and then detemine if the mouse is down or up, and based on that, delete the brushstrokes. The problem is that since these brushstrokes are attached to the component, the event handlers of the component override those of the brushstokes (so I'm told). So, I have a function that goes through each brushstroke element and set it's rollOver method to that sort of erase function under the proper circumstances. The problem I'm having, though, is that rollOVer doesn't get activated for the brushstrokes. It gets set, as executing _level0.myClip.brushstroke0.onRollOver() will produce the desired results. It's simply a matter of efficiently activating the rollOver method with the mouse. It's simply inactive.
Wouldn't that involve checking a hitTest for each child element on mouseMove? The thing is, the number of child elements could potentially be large enough that this would be too slow for the application. I figure it would be more effective to use the built-in rollOver method. This, I think would offer the required efficiency.
using a hitTest() with onMouseDown is a more efficient. you only need one mouse listener and one onMouseDown handler if you can be clever about the individual handlers: lo = new Object(); lo.onMouseDown = function() { for (parent in yourParents) { for (mc in parent) { if (parent[mc].hitTest(_xmouse, _ymouse)) { // do whatever } } } }; yourParents = []; Mouse.addListener(lo);
Don't see what you're looking for? Try a search.
|