[RESOLVED] Setting up variables in different levels
Actionscript Code:
if (Key.isDown(attack2Key)&&shot2reload == 0) {
for (i=1; i<2+1; i++) {
shot2++;
shot2reload = 30
var newname = "shot2_"+shot2;
_root.attachMovie("shot2", newname, shot2*100+1);
_root[newname]._y = _root.player._y;
_root[newname]._x = _root.player._x+i*40-60;
_root[newname].onEnterFrame = function() {
var yVel = 10;
this._y -= yVel;
if (this._y<0) {
this.removeMovieClip();
}
};
trace (_root.[newname].yVel)
}
}
rather than setting speed(yVel) in the onEnterFrame,
I want to set it as I create the movieclip I'm stuffing it in.
The trace is my attempt to access that variable