hi,
Im having a bit of bother with this one. I have a flash file which loads in vars from director. It then adds the values to a graph. The amounts from the string are inputed into text fields. the fields are named energy, waste etc. I want a textfield to output whichever sections that are over 5 saying "well done, you have excelled in water, energy… I have got this working but am stuck on this bit: I am wanting to add an “and” before the last item, so it outputs as “well done you have excelled in water, waste and energy”. Also if only one item is over 5 it wont add the “and”. This probably doesnt make any sense, heres my code anyhow:
var summary_results = "2000,6,3,10,8,6";
var txtFields:Array = [Total,Energy,Waste,Water,Food,Transport];
var excelledItems:Array = [];
var theValues:Array = summary_results.split(",");
for(var i=1;i<theValues.length;i++){
theValues* = Number(theValues*);
txtFields*.text = theValues*;
if(theValues* >= 5){
theValues* == txtFields*;
excelledItems.push(" " + txtFields*._name);
if(excelledItems.length > 1){
//add an "and" somehow....
}
}
}
//well done text
wellDone = "Well Done!
You have excelled in"+ excelledItems +". You know these Eco topics well!";
stop();