Meerdere movieclips in drag&drop (FLASH)

Onderstaande source is van de site [url=http://www.liquidjourney.com]liquidjourney.com[/url] (> dynamics) ... k vind hem leuk maar niet gebruiksvriendelijk. K zou graag hetzelfde effect willen maar met verschillende movieclips ipv verschillende variaties op één movieclip (zoals nu het geval). Op [url=http://www.vdbm.be/source/dragdrop.swf]dit adres[/url] kan je de swf in actie zien ([url=http://www.vdbm.be/source/dragdrop.fla]hier[/url] kan je de fla downloaden).

Zou er mij iemand kunnen helpen … of tenminste een beetje op gang kunnen zetten? thx :wink:

frame1:

[code:1:ce7265e6db]var left:Number = this.frame_mc._x;
var right:Number = left+this.frame_mc._width;
var top:Number = this.frame_mc._y;
var bottom:Number = top+this.frame_mc._height;
this.frame_mc.swapDepths(2001);[/code:1:ce7265e6db]
frame2:

[code:1:ce7265e6db]//
var amt:Number;
function setQuality(thisSpeed:Number):Void {
if (thisSpeed == 1) {
amt = 15;
} else if (thisSpeed == 2) {
amt = 32;
} else {
amt = 50;
}
}
setQuality(_global.speed);
//
var degreesToRadians:Number = Math.PI/180;
var radiansToDegrees:Number = 180/Math.PI;
//
// a = a_point :: b = b_point
function myAngle(ax:Number, bx:Number, ay:Number, by:Number):Number {
var c:Number = Math.atan2((ay-by), (ax-bx))radiansToDegrees;
return (c);
}
//
function createBackground():Void {
// the background
this.createEmptyMovieClip("bk", 1);
var bk:MovieClip = this["bk"];
var colors:Array = [0x121321, 0x6FA2AC];
var alphas:Array = [100, 100];
var ratios:Array = [0, 255];
var matrix:Object = {matrixType:"box", x:left, y:top, w:(right-left)+left, h:bottom-top, r:Math.PI/2.9};
bk.beginGradientFill("linear", colors, alphas, ratios, matrix);
bk.moveTo(left, top);
bk.lineTo(right, top);
bk.lineTo(right, bottom);
bk.lineTo(left, bottom);
bk.lineTo(left, top);
bk.endFill();
this.createEmptyMovieClip("ele", 2);
var ele:MovieClip = this["ele"];
this.createEmptyMovieClip("mask", 3);
var mask:MovieClip = this["mask"];
mask.beginFill(0x000000, 100);
mask.moveTo(left, top);
mask.lineTo(right, top);
mask.lineTo(right, bottom);
mask.lineTo(left, bottom);
mask.lineTo(left, top);
mask.endFill();
ele.setMask(mask);
}
//
//
function clearAll():Void {
removeMovieClip("ele");
removeMovieClip("mask");
removeMovieClip("bk");
}
//
function setUp():Void {
createBackground();
var ele:MovieClip = this["ele"];
for (var i:Number = 0; i<amt; i++) {
ele.attachMovie("drag_object", "holder"+i, i);
var holder:MovieClip = ele["holder"+i];
holder._x = Math.floor(left+(right-left)/2);
holder._y = Math.floor(top+(bottom-top)/2);
holder.cenx = (right-left)/2;
holder.ceny = (bottom-top)/2;
holder.dragStop = function():Void {
onMouseMove = undefined;
this.lead.vel_x = this.lead.dif_x
this.lead.mass;
this.lead.vel_y = this.lead.dif_ythis.lead.mass;
this.follow.vel_x = this.lead.dif_x
this.follow.mass;
this.follow.vel_y = this.lead.dif_y*this.follow.mass;
this.clip.onEnterFrame = function():Void {
var myP:MovieClip = this._parent;
var posx:Number = this._x+myP.lead.vel_x;
this._x = posx;
if (posx+40 > myP.cenx) {
// too far right
myP.lead.vel_x = -24;
} else if (posx-40 < -myP.cenx) {
// too far left
myP.lead.vel_x = 24;
}
var posy:Number = this._y+myP.lead.vel_y;
this._y = posy;
if (posy+40 > myP.ceny) {
// too far to the bottom
myP.lead.vel_y = -24;
} else if (posy-40 < -myP.ceny) {
// too far to the top
myP.lead.vel_y = 24;
}
myP.lead._x = this._x;
myP.lead._y = this._y;
myP.lead.vel_x *= 0.75;
myP.lead.vel_y *= 0.75;
myP.follow.xTarg += myP.follow.vel_x;
myP.follow.yTarg += myP.follow.vel_y;
myP.follow.vel_x *= 0.68;
myP.follow.vel_y *= 0.68;
myP.lead.old_x = myP.lead._x;
myP.lead.old_y = myP.lead._y;
myP.follow._x += (myP.follow.xTarg-myP.follow._x)/5;
myP.follow._y += (myP.follow.yTarg-myP.follow._y)/5;
this._rotation = myAngle(myP.clip._x, myP.follow._x, myP.clip._y, myP.follow._y)+90;
if (Math.abs(myP.lead.vel_x)<0.05 && Math.abs(myP.lead.vel_y)<0.05 && Math.abs(myP.follow.vel_x)<0.1 && Math.abs(myP.follow.vel_y)<0.1) {
this.onEnterFrame = undefined;
}
};
this.lead.onEnterFrame = undefined;
this.follow.onEnterFrame = undefined;
stopDrag();
};
holder.dragStart = function():Void {
this.clip.onEnterFrame = undefined;
this.clip.startDrag(false, -this.cenx-100, -this.ceny-100, this.cenx+100, this.ceny+100);
this.lead.onEnterFrame = function():Void {
var myP:MovieClip = this._parent;
this._x = myP.clip._x;
this._y = myP.clip._y;
this.dif_x = this._x-this.old_x;
this.dif_y = this._y-this.old_y;
this.old_x = this._x;
this.old_y = this._y;
this.onMouseMove = function():Void {
this.xTarg += (_xmouse-this._x)/1.2;
this.yTarg += (_ymouse-this._y)/1.2;
this._parent.follow.xTarg += (this._x-this._parent.follow.xTarg)/17;
this._parent.follow.yTarg += (this._y+200-this._parent.follow.yTarg)/6;
updateAfterEvent();
};
};
this.follow.onEnterFrame = function():Void {
this._x += (this.xTarg-this._x)/5;
this._y += (this.yTarg-this._y)/5;
this._parent.clip._rotation = myAngle(this._parent.clip._x, this._x, this._parent.clip._y, this._y)+90;
this.dif_x = this._x-this.old_x;
this.dif_y = this._y-this.old_y;
this.old_x = this._x;
this.old_y = this._y;
};
};
holder.clip.onPress = function():Void {
/////////////////////////////////////////////////// remove temporary clip
if (ele.hint) {
ele.hint.removeMovieClip();
}
///////////////////////////////////////////////////
this._parent.swapDepths(this._parent._parent.getNextHighestDepth());
this._parent.dragStart();
};
holder.clip.onRelease = function():Void {
this._parent.dragStop();
};
holder.clip.onReleaseOutside = function():Void {
this._parent.dragStop();
};
holder.clip.useHandCursor = false;
holder.clip._x = Math.floor(Math.random()*400-200);
holder.clip._y = Math.floor(Math.random()*300-150);
var col:Color = new Color(holder.clip.body_mc);
var colTrans:Object = {ra:100, rb:Math.round(Math.random()*40-50), ga:100, gb:Math.round(Math.random()*100-50), ba:100, bb:Math.round(Math.random()*100-50)};
col.setTransform(colTrans);
//
holder.lead.mass = 1.2;
holder.lead._x = holder.clip._x;
holder.lead._y = holder.clip._y;
holder.lead.old_x = holder.lead._x;
holder.lead.old_y = holder.lead._y;
holder.lead.xTarg = holder.lead._x;
holder.lead.yTarg = holder.lead._y;
holder.lead.vel_x = 0;
holder.lead.vel_y = 0;
holder.lead.dif_x = 0;
holder.lead.dif_y = 0;
holder.lead._alpha = 20;
holder.lead._visible = false;
//
holder.follow.mass = 1.6;
holder.follow._x = holder.lead._x+Math.random()*200-100;
holder.follow._y = holder.lead._y+100;
holder.follow.xTarg = holder.lead._x;
holder.follow.yTarg = holder.lead._y+100;
holder.follow.targx = holder.follow._x;
holder.follow.targy = holder.lead._y+100;
holder.follow.dx = 0;
holder.follow.dy = 0;
holder.follow.vel_x = 0;
holder.follow.vel_y = 0;
holder.follow.dif_x = 0;
holder.follow.dif_y = 0;
holder.follow._alpha = 20;
holder.follow._visible = false;
holder.clip._rotation = myAngle(holder.clip._x, holder.follow._x, holder.clip._y, holder.follow._y)+90;
/////////////////////////////////////////////////// temporary clip
ele.attachMovie("hint", "hint", 50);
var hint:MovieClip = ele["hint"];
hint._x = Math.floor(left+70);
hint._y = Math.floor(bottom-22);
hint._txt.text = "click and drag objects";
}
}
setUp();
//
stop();[/code:1:ce7265e6db]
frame 13:

[code:1:ce7265e6db]clearAll();
stop();[/code:1:ce7265e6db]