PDA

View Full Version : Help with Combo Box


cocoonfx
03-20-2008, 04:14 AM
Hello Chaps


I am pulling my hair out over a combo box in Flash CS3.

All i want to do is have a combo box (instant name = cb) which has

low
medium
high

I then want to have an if statment will take the selection which then will do a calculation and then place the results in a text box (text).

if (cb == low){
var x = 1*10;
text = x;
}

Now the crazy thing is i can link a movie clip to combo box and get it to jump from frame to frame, but i can do the above calculation.

var mylist:Object = new Object();
db.addEventListener("change",mylist);



mylist.change = function() {


mcTest.gotoAndStop(db.value);

};

help!!!

cocoonfx
03-25-2008, 02:22 PM
Can anyone help?

cocoonfx
04-01-2008, 01:38 AM
Anyone?:lol:

cocoonfx
04-04-2008, 12:38 AM
All sorted now...

btnCheck.addEventListener(MouseEvent.CLICK, checkAnswer);
function checkAnswer(evt:MouseEvent):void {

/// Male age 10-18////
if (aCb.value=="Male" && bCb.value=="1") {
var a1:Number=Number(weight.text);
var c1:Number = Number((a1*17.5)+651);
var cal1 = Math.floor(c1);
RMR.text= cal1;
}
/// Male age 19-30 ////
if (aCb.value=="Male" && bCb.value=="2") {
var a2:Number=Number(weight.text);
var c2:Number = Number((a2*15.3)+679);
var cal2 = Math.floor(c2);
RMR.text= cal2;
}
/// Male age 31+///
if (aCb.value=="Male" && bCb.value=="3") {
var a3:Number=Number(weight.text);
var c3:Number = Number((a3*11.6)+879);
var cal3 = Math.floor(c3);
RMR.text= cal3;

}/// Male exercise 10-18 /////

if (aCb.value=="Male" && bCb.value=="1" && cCb.value=="1") {
var ex1 = cal1*0.2;
var ext1 = ex1+cal1;
RMR.text= ext1;
}
if (aCb.value=="Male" && bCb.value=="1" && cCb.value=="2") {
var ex2 = cal1*0.5;
var ext2 = ex2+cal1;
RMR.text= ext2;
}
if (aCb.value=="Male" && bCb.value=="1" && cCb.value=="3") {
var ext3 = cal1+cal1;
RMR.text= ext3;
/// End 10-18 ////
}/// Male exercise 19-30 /////

if (aCb.value=="Male" && bCb.value=="2" && cCb.value=="1") {
var ex4 = cal2*0.2;
var ext4 = ex4+cal2;
RMR.text= ext4;
}
if (aCb.value=="Male" && bCb.value=="2" && cCb.value=="2") {
var ex5 = cal2*0.5;
var ext5 = ex5+cal2;
RMR.text= ext5;
}
if (aCb.value=="Male" && bCb.value=="2" && cCb.value=="3") {
var ext6 = cal2+cal2;
RMR.text= ext6;
}/// End 19-30 ////
/// Male exercise 31 /////

if (aCb.value=="Male" && bCb.value=="3" && cCb.value=="1") {
var ex7 = cal3*0.2;
var ext7 = ex7+cal3;
RMR.text= ext7;
}
if (aCb.value=="Male" && bCb.value=="3" && cCb.value=="2") {
var ex8 = cal3*0.5;
var ext8 = ex8+cal3;
RMR.text= ext8;
}
if (aCb.value=="Male" && bCb.value=="3" && cCb.value=="3") {
var ext9 = cal3+cal3;
RMR.text= ext9;
}/// End 31+ ////
/////////////////

if (aCb.value=="Female" && bCb.value=="1") {
var a4:Number=Number(weight.text);
var c4:Number = Number((a4*12.2)+746);
var cal4 = Math.floor(c4);
RMR.text= cal4;
}
if (aCb.value=="Female" && bCb.value=="2") {
var a5:Number=Number(weight.text);
var c5:Number = Number((a5*14.7)+496);
var cal5 = Math.floor(c5);
RMR.text= cal5;
}
if (aCb.value=="Female" && bCb.value=="3") {
var a6:Number=Number(weight.text);
var c6:Number = Number((a6*8.7)+829);
var cal6 = Math.floor(c6);
RMR.text= cal6;
}
if (aCb.value=="Female" && bCb.value=="1" && cCb.value=="1") {
var fx1 = cal4*0.2;
var fxt1 = fx1+cal4;
RMR.text= fxt1;
}
if (aCb.value=="Female" && bCb.value=="1" && cCb.value=="2") {
var fx2 = cal4*0.2;
var fxt2 = fx2+cal4;
RMR.text= fxt2;
}
if (aCb.value=="Female" && bCb.value=="1" && cCb.value=="3") {
var fxt3 = cal4+cal4;
RMR.text= fxt3;
}////19+///
if (aCb.value=="Female" && bCb.value=="2" && cCb.value=="1") {
var fx4 = cal5*0.2;
var fxt4 = fx4+cal5;
RMR.text= fxt4;
}
if (aCb.value=="Female" && bCb.value=="2" && cCb.value=="2") {
var fx5 = cal5*0.2;
var fxt5 = fx5+cal5;
RMR.text= fxt5;
}
if (aCb.value=="Female" && bCb.value=="2" && cCb.value=="3") {
var fxt6 = cal5+cal5;
RMR.text= fxt6;
}///30+////
if (aCb.value=="Female" && bCb.value=="3" && cCb.value=="1") {
var fx7 = cal6*0.2;
var fxt7 = fx7+cal6;
RMR.text= fxt7;
}
if (aCb.value=="Female" && bCb.value=="3" && cCb.value=="2") {
var fx8 = cal6*0.2;
var fxt8 = fx5+cal6;
RMR.text= fxt8;
}
if (aCb.value=="Female" && bCb.value=="3" && cCb.value=="3") {
var fxt9 = cal6+cal6;
RMR.text= fxt9;
}
if (aCb.value=="reset") {
RMR.text="";
weight.text="";
}
if (bCb.value=="reset") {
RMR.text="";
weight.text="";
}
if (aCb.value=="reset" && bCb.value=="reset" && cCb.value=="reset") {
RMR.text="";
weight.text="";
}

}