West Technology Limited:Exclusive Values for Multiple Variables
West Technology Limited:Exclusive Values for Multiple Variables
The artcile was brought by the West Technology Limited
Guys and Gals,
I've got a new one for you that I haven't seen on the forum and I figured I'd put it out there while I figure out a solution. Here it goes:
I've built an Ad Builder module (yeah!) that at one point has an option for bullet points for the ad. There are 5 combo boxes (they get to have 5 bullet points) with identical lists. Once a selection is made to a combo box, it changes the corresponding variable through a Change Handler function (thanks NTD!).
Before the user is allowed to proceed to the next step, I check that all the fields are filled in (they can't have a blank bullet point). For all the other sections, this was easy because either there is a value for the variable or no value. For these combo boxes, the code to do that looks like this:
_root.displaybuildcontent.displaynext2.onPress = function() {
if ((_root.bull1 != null)&& (_root.bull2 != null)&& (_root.bull3 != null) && (_root.bull4 != null) && (_root.bull5 != null)) {
nextFrame();
}
else {
_root.displaybuildcontent.required2._alpha=100;
fieldCheck2(_root.bull1,_root.displaybuildcontent. requiredBull1);
fieldCheck2(_root.bull2,_root.displaybuildcontent. requiredBull2);
fieldCheck2(_root.bull3,_root.displaybuildcontent. requiredBull3);
fieldCheck2(_root.bull4,_root.displaybuildcontent. requiredBull4);
fieldCheck2(_root.bull5,_root.displaybuildcontent. requiredBull5);
}
};
The "_root.bull1"s are the variables. "_root.displaybuildcontent.required2" is the text box theat says "Required field", and the "_root.displaybuildcontent.requiredBull1"s are the asteriks for the specific combo box.
The fieldCheck2 function code is this:
function fieldCheck2(myVariable,myTarget){
if (myVariable != null){
myTarget._alpha = 0;
} else {
(myVariable == null)
myTarget._alpha = 100;
}
};
This works great, because if any of the variables = null, it not only stops you from proceeding, it tells you which fields your missing, and rechecks the variables every time you press the "_root.displaybuildcontent.displaynext2" button (movieclip).
Now, what I want to do is have it not only check that the variables != null before proceeding, but that the variables do not equal each other.
I think it can be done with a huge if/else statement, but does anyone have a more refined way of comparing multiple variables' values not equalling each other?
I'll keep working on it, but I thought I'd give the "experts" a try too.
Thanks
|