I need to have the VAR 'MyMovie" be defined and used in an onEnterFrame within a function.
here is my code:
function MoveMovie(
MyMovie:String,xEnd:Number,yEnd:Number){
trace(
MyMovie);
<------ This works = Box DividedBy = 5;
MyMovie.onEnterFrame = function(){
<-----This does not!
How do I call "MyMovie" in an onEnterFrame or the properties of MyMovie. example MyMovie._x? cpx = (xEnd - this._x) / DividedBy;
cpy = (yEnd - this._y) / DividedBy;
trace(this._x);
trace(this._y);
//cp = Math.round(cp);
this._x += cpx;
this._y += cpy;
Rounded = Math.round(this._x);
Rounded = Math.round(this._y);
trace(Rounded);
if(Rounded == xEnd or Rounded == yEnd) { delete this.onEnterFrame;}
}
}
Box.onPress = function(){
MoveMovie(
"Box",777,198);
}