I’ve created a code to add a custom cursor and drag movieclips.
it works fine for one moviclip.
But I would like to create a function to add the drag function with custom cursor to any movieClip that i add to an array.
My first try has problems cause i need to create a different listener name to each movieClip.
cMouse = CustomMouse;
mystring:FunctionParameters = movieClipsNames;
mouseListener => Needs to duplicate (i guess);
I’m stucked in this point, can anyone help me?
my code is above
function arrastar (mystring) {
arrasta = false;
cMouse._x = _xmouse;
cMouse._y = _ymouse;
clips_array = new Array();
clips_array=mystring.split(",");
for (var i:String in clips_array)
{
var mouseListener:Object = new Object();
mouseListener.onMouseMove = function() {
if (clips_array*.hitTest(_xmouse, _ymouse, false)) {
Mouse.hide();
if (arrasta == true) {
cMouse.gotoAndStop(3);
} else {
cMouse.gotoAndStop(2);
}
} else {
if (arrasta == true) {
cMouse.gotoAndStop(3);
} else {
cMouse.gotoAndStop(1);
Mouse.show();
}
}
updateAfterEvent();
};
mouseListener.onMouseDown = function() {
if (clips_array*.hitTest(_xmouse, _ymouse, false)) {
cMouse.gotoAndStop(3);
arrasta = true;
}
};
mouseListener.onMouseUp = function() {
if (clips_array*.hitTest(_xmouse, _ymouse, false)) {
cMouse.gotoAndStop(2);
} else {
cMouse.gotoAndStop(1);
Mouse.show();
}
arrasta = false;
};
Mouse.addListener(mouseListener);
clips_array*.onPress = function() {
startDrag(clips_array*);
}
clips_array*.onRelease = clips_array*.onReleaseOutside = function () {
stopDrag();
}
trace(clips_array*);
}
}
arrastar ('mc1,mc2,mcX');
I’ve attached my original working code to 1 movieclip with a customCursor onRollOver