I’ve got a prototype on my main timeline i’d like to call and also pass args to it. It works fine if I code it without arguments, but when i change the code so i can pass args it doesn’t work at all, but the right data is being traced.
(i’ve got a dynamic txt box onstage with var t1, and an array called tumbler1)
var one = 0;
time = tumbler1.length;
//here when i run this function all i get are traces but the cycle through of the text doesn't work
MovieClip.prototype.spinner = function(numbervar,timevar,array,textvar){
//one = 0;
trace(numbervar);
trace(timevar);
trace(array);
trace(textvar);
numbervar = 0;
this.onEnterFrame = function() {
if(numbervar<timevar){
textvar = array[numbervar++];
}else if (numbervar=timevar){
numbervar = random(array.length);
textvar = array[numbervar];
trace(numbervar);
delete this.onEnterFrame;
}
}
}
//this function however, works fine
MovieClip.prototype.spinner2 = function(){
one = 0;
this.onEnterFrame = function() {
if(one<time){
t1 = tumbler1[one++];
}else if (one=time){
one = random(tumbler1.length);
t1 = tumbler1[one];
trace(one);
delete this.onEnterFrame;
}
}
}
//functions being called on a button in a mc
on (release){
//spinner2();
spinner("one","time","tumbler1","t1");
}