PDA

View Full Version : button click while using drag and drop


kamfurz
03-17-2006, 04:12 AM
hi
I have a movie clip containing picture and buttons over it.I want to move the entire mc using drag and drop.While doing this the buttons are not working,can anybody help me out?

fingolfin
03-29-2006, 03:26 PM
hi!
I have solved by putting a movie clip inside the movie clip that I drag.
Inside this movie clip there is a button called, let's say, btn1.
If you have more than one button, just name them btn2, btn3 etc and extend the action for the others.
In the main timeline i've put this action I found here somewhere that works with 3 buttons.

var inst_events = new Object();
Mouse.addListener(inst_events);

inst_events.onMouseDown = function(){
if (btn1.hitTest(_root._xmouse, _root._ymouse, true)) {
// top_mc onPress
trace("First house was just pressed");

}else if (btn2.hitTest(_root._xmouse, _root._ymouse, true)) {
// middle_mc onPress
trace("Middle house was just pressed");
}else if (bottom_mc.hitTest(_root._xmouse, _root._ymouse, true)) {
// bottom_mc onPress
trace("Last house was just pressed");
}
}

Then, back to the button you've put inside the movieclip, you assign the action you want it to have.

Now I'm stuck trying to put an action for a button so that the movieclip moves to a certain x,y value.
If you want we can try and work this out together.

Hope this helps.

Ciao,
F