Controlling a movie clip dynamically from mySQL

I have a movie clip with 11 frames containing 10 different images named “thermometer”. I have a dynamic text box on the root of the movie with the var name of “therm”

action script in MC “thermometer”=

onEnterFrame = function() {
if ((therm <= 15000) && (therm >= 0)){
gotoAndStop(2);
} else if ((therm <= 30000) && (therm >= 15000)) {
gotoAndStop(3);
} else if ((therm <= 45000) && (therm >= 30000)) {
gotoAndStop(4);
} else if ((therm <= 60000) && (therm >= 45000)) {
gotoAndStop(5);
} else if ((therm <= 75000) && (therm >= 60000)) {
gotoAndStop(6);
} else if ((therm <= 90000) && (therm >= 75000)) {
gotoAndStop(7);
} else if ((therm <= 105000) && (therm >= 90000)) {
gotoAndStop(8);
} else if ((therm <= 120000) && (therm >= 105000)) {
gotoAndStop(9);
} else if ((therm <= 135000) && (therm >= 120000)) {
gotoAndStop(10);
} else if (therm >= 135000) {
gotoAndStop(11);

}

the “therm” var will be populated through mySQL and PHP. what am i missing in my action script?

anyone?

does it have something to do with not using _root or _parent wehn calling on the variable “therm”?

first, if therm is textfield then value that is entered in textfield is therm.text
if you want to convert it to number use Number(therm.text)

second, this multiple if’s doesn’t lead anything
if you are into something like that use switch command
but here you can produce mathematic formula to get to the right frame

onEnterFrame = function() {
        // so therm can be equal this
       thermT = Number(_root.therm.text);
	frame = 1 + Math.floor(thermT / 15000);
	_root.gotoAndPlay(frame);
	// if you can have number higher than 150000 for therm and still want to set 11 as higher number use one if like 
	// if (frame>11) { frame = 11};
}
onEnterFrame = function() {
        // so therm can be equal this
       thermT = Number(_root.therm.text);
    frame = 1 + Math.floor(thermT / 15000);
    _root.gotoAndPlay(frame);
    // if you can have number higher than 150000 for therm and still want to set 11 as higher number use one if like 
    // if (frame>11) { frame = 11};
}

[/quote]

wow this looks cool.
the problem still is that textbox with the “therm” variable assiagned is on the root. I am trying to control the frame with a MC on the root.

so would it really be: “_root.gotoAndPlay(frame);” ???
woudln’t that control the root timeline and not the movie clip that i am trying to control?

ok
replace _root with mc name