Oke, I couldn’t find anything about this one…
I have a number of mc’s on my mainstage. About ten each named target1, target2 etc.
I have a target problem. I wrote a prototype where I check if a dragged picture (piece1, piece2) is above target1 then… etc.etc.
Working just fine because I stated the coordinates of the image1 etc.
While it’s a prototype I thought why not use the _x of image1 … instead of saying what the _X coordinate is…
Get it so far?
No? this is the prototype I’m talking about…
// Jigsaw puzzle V1.0 design by www.fromthemill.nl
MovieClip.prototype.jigsaw = function(ocx, ocy, ncx, ncy, pic) {
// ocx = original coordinate x ncx = new coordinate x pic = piecenumber
this.onPress = function() {
_root.i++;
startDrag(this);
this.swapDepths(i);
lines.swapDepths(i+1);
};
this.onRelease = function() {
stopDrag();
var item = "target"+pic;
// item: target is the instance name, pic is declared in my prototype
if (this._droptarget == item) {
this._x = item._x;
this._y = item._y;
} else {
this._x = ocx;
this._y = ocy;
}
delete this.onEnterframe;
};
};
piece1.jigsaw(189, 74, 1);
// so I only state the original x & y coordinates and the piece number
Problem: How to ‘target’ in AS1 the _x of a " “target”+pic " ???