all groups > flash actionscript > november 2005 >
You're in the

flash actionscript

group:

_root problems II



_root problems II spsavage
11/30/2005 10:18:47 PM
flash actionscript: I posted a message earlier in the day and have half an answer. Would anyone be
able to give me a solution?

I have a button (called "button1") inside a movieclip("disc"), which when
pressed will hopefully load an external image into a movieclip called "imageMC"?

However the mc "disc" has a mouse handler on it which means the button is
being ignored.

I really need to get this button to recognise the press.

The actionscript I have on the button is:

on (release) {
_root.imageMC.loadMovie("images/picture1");
}

The movieclip "disc" has the following code inside it:

circlemc.onRollOver = function() {
circlemc.onEnterFrame = null;
}
circlemc.onEnterFrame = function() {
circlemc._rotation -= 0.75;
}
circlemc.onRollOut = function() {
circlemc.onEnterFrame = function() {
circlemc._rotation += 0.75;

}
}

I've been informed I need to call in a mouse handler for the button before the
above script, but I don't know how to do this.

Any help would be gratefully received. Thanks in advance.


Re: _root problems II kglad
12/1/2005 4:05:32 PM
actually, you can't have mouse handler's assigned to a parent movieclip and
expect a child to detect mouse events. they will be intercepted by the parent.

to remedy, either use a hitTest(), a mouse position detection or define your
mouse handlers for the youngest generation that needs handlers.
Re: _root problems II spsavage
12/1/2005 4:09:45 PM
Hi kglad,

Thanks for your help again. If I put the hittest on the button, would this
counteract the parent/child issue?

I don't suppose I could send you the file to have a look at?

TIA

Steve
Re: _root problems II kglad
12/1/2005 5:08:26 PM
yes, it would. for example:

lo = new Object();
lo.onMouseDown = function() {
if (circlemc.button1.hitTest(_xmouse, _ymouse)) {
_root.imageMC.loadMovie("images/picture1");
}
};
Mouse.addListener(lo);


AddThis Social Bookmark Button