ok so basicly what i want to create is a random card dealer.
to start i want to deal 18 cards, but one at a time.
here is what i have so far:
nextcard = function () {
this.onEnterFrame = function() {
if (Math.round(this._x) == this.destX && Math.round(this._y) == this.destY) {
//=======================================================
_parent[this.myNextCard].nextcard();
//=======================================================
delete this.onEnterFrame;
} else {
this._x = this._x+(this.destX-this._x)/5;
this._y = this._y+(this.destY-this._y)/5;
this._rotation = this.rmax+(this.destY-this._y)/5;
if (this._xscale>=100) {
this._xscale -= 15;
this._yscale -= 15;
}
}
};
};
for (var i = 0; i<18; i++) {
item = _root.attachMovie("card", "card"+i, i);
item.myNextCard = "card"+(i+1);
item._x = 0;
item._y = 0;
item._xscale = 200;
item._yscale = 200;
item.destX = Math.round(Math.random()*Stage.width);
item.destY = Math.round(Math.random()*Stage.height);
item.rmax = Math.round(Math.random()*225);
if (i == 0) {
item.onEnterFrame = function() {
if (Math.round(this._x) == this.destX && Math.round(this._y) == this.destY) {
//=======================================================
_parent[this.myNextCard].nextcard();
//=======================================================
delete this.onEnterFrame;
} else {
this._x = this._x+(this.destX-this._x)/5;
this._y = this._y+(this.destY-this._y)/5;
this._rotation = this.rmax+(this.destY-this._y)/5;
if (this._xscale>=100) {
this._xscale -= 15;
this._yscale -= 15;
}
}
};
}
}
the first card comes out, but i cant seem to attach the nextcard function to [myNextCard].
is there a better way to pace this? or am i just targeting the function incorrectly?