Thanks for the reply. It somewhat works now however it will only show 1 of the movie clips at a time. I want it to display both movie clips representing subscripts for the checmical equations. I’m not too sure what I’m doing wrong??
//Global variables
var myChemEq:Array=;
var Operator:Array=[“+”];
var myalpha:Array=[“H”, “C”, “O”, “CH”];
var minNum:Number=3;
var maxNum:Number=8;
var VALUE=Math.ceil(Math.random()*(maxNum-minNum+1))+(minNum-1);
for (var i:Number =0; i< 10; i++) {
var VALUE2:Number = Math.round((Math.random() * 10)+1);
}
var randOp:Number = Math.round(Math.random() * (Operator.length - 1));
var randAlpha:Number = Math.round(Math.random() * (myalpha.length - 1));
var tmpequation:String = VALUE.toString() + "" + myalpha[randAlpha] + " " + Operator.toString()+ ""+VALUE2.toString() + "" + myalpha[randAlpha] + " ";
//Generates the random equation and current equation holds the current equation we are on
myChemEq.push(tmpequation);
var counter=Math.round(Math.random())
this.onEnterFrame = function() {
if (counter == 0) {
this.createEmptyMovieClip(“emptyMC”, this.getNextHighestDepth());
emptyMC.attachMovie(“mc_2”, “sub2”, emptyMC.getNextHighestDepth(), {_x:250, _y:80});
delete this.onEnterFrame;
} else if (counter == 1) {
this.createEmptyMovieClip(“emptyMC”, this.getNextHighestDepth());
emptyMC.attachMovie(“mc_3”, “sub3”, emptyMC.getNextHighestDepth(), {_x:250, _y:80});
this.onEnterFrame;
}
};
//Next subscript for chemical equation
var counter2=Math.round(Math.random())
this.onEnterFrame = function() {
if (counter2 == 0) {
this.createEmptyMovieClip(“emptyMC”, this.getNextHighestDepth());
emptyMC.attachMovie(“mc_2”, “sub2”, emptyMC.getNextHighestDepth(), {_x:320, _y:80});
delete this.onEnterFrame;
} else if (counter2 == 1) {
this.createEmptyMovieClip(“emptyMC”, this.getNextHighestDepth());
emptyMC.attachMovie(“mc_3”, “sub3”, emptyMC.getNextHighestDepth(), {_x:320, _y:80});
this.onEnterFrame;
}
};
var currentEq:Number=0;
this.createTextField(“rand_txt”,this.getNextHightestDepth(),
300, 50,150,200);
rand_txt.text=“”;
var setEquation:Function =function(){
rand_txt.text=myChemEq[currentEq];
}
setEquation();