flash actionscript:
Hi - I appreciate any specific help on this problem. I've developed a Flash
Drag & Drop game for kids to dress a character properly for winter snow sports
(skiing, snowboarding, xc & snowshoe) -- I've got everything working
beautifully except for the fact that I would like the give the user the choice
of a helmet OR a hat and still have either selection be considered correct. I
know I'm looking at a logical OR operator (or at least I believe I am) -- but
it is just NOT working. Can someone please please please take a look at my code
asap and let me know what you think the problem is? The helmet is comprised of
a mc with a nested button (instance name is 'boaderhelmet' - and the hat's
instance name is "boarderhat".....here's the whole code for all the items...
THANKS SO MUCH!
:confused;
var top1;
var top2;
var top3;
var pants1;
var pants2;
var feet1;
var feet2;
var glove1;
var glove2;
var helmet;
var hat;
wicktopmc.onPress = function(){this.startDrag();} // drag object you can put
this in your on(press) button code
layer2mc.onPress = function(){this.startDrag();} // drag object
boardjacketmc.onPress = function(){this.startDrag();} // drag object
wickpantsmc.onPress = function(){this.startDrag();}
boardpantsmc.onPress = function(){this.startDrag();}
boardsocksmc.onPress = function(){this.startDrag();}
boardbootsmc.onPress = function(){this.startDrag();}
glove1.onPress = function(){this.startDrag();}
glove2.onPress = function(){this.startDrag();}
helmetmc.onPress = function(){this.startDrag();}
hatmc.onPress = function(){this.startDrag();}
wicktopmcX = wicktopmc._x; // put circle back if dropped in wrong place
wicktopmcY = wicktopmc._y;
wicktopmc.onRelease = function(){
if (wicktopmc.hitTest(shirt_pos)){
stopDrag();
this._x=_root.shirt_pos._x+(_root.shirt_pos._width/2)-(this._width/2);
this._y=_root.shirt_pos._y+(_root.shirt_pos._height/2)-(this._height/2);
top1 = 'boardwickingtop'; // set top 1 variable to 'skithermalshirt'
}else{
stopDrag();
wicktopmc._x = wicktopmcX;
wicktopmc._y = wicktopmcY;
}
}
layer2mcX = layer2mc._x;
layer2mcY = layer2mc._y;
layer2mc.onRelease = function(){
if (layer2mc.hitTest(shirt_pos)){
stopDrag();
this._x=_root.shirt_pos._x+(_root.shirt_pos._width/2)-(this._width/2);
this._y=_root.shirt_pos._y+(_root.shirt_pos._height/2)-(this._height/2);
top2 = 'boardinsulating';
}else{
stopDrag();
layer2mc._x = layer2mcX;
layer2mc._y = layer2mcY;
}
}
boardjacketmcX = boardjacketmc._x;
boardjacketmcY = boardjacketmc._y;
boardjacketmc.onRelease = function(){
if (boardjacketmc.hitTest(shirt_pos)){
stopDrag();
this._x=_root.shirt_pos._x+(_root.shirt_pos._width/2)-(this._width/2);
this._y=_root.shirt_pos._y+(_root.shirt_pos._height/2)-(this._height/2);
top3 = 'boardjacket';
}else{
stopDrag();
boardjacketmc._x = boardjacketmcX;
boardjacketmc._y = boardjacketmcY;
}
}
wickpantsmcX = wickpantsmc._x;
wickpantsmcY = wickpantsmc._y;
wickpantsmc.onRelease = function(){
if (wickpantsmc.hitTest(pants_pos)){
stopDrag();
this._x=_root.pants_pos._x+(_root.pants_pos._width/2)-(this._width/2);
this._y=_root.pants_pos._y+(_root.pants_pos._height/2)-(this._height/2);
pants1 = 'wickpants';
}else{
stopDrag();
wickpantsmc._x = wickpantsmcX;
wickpantsmc._y = wickpantsmcY;
}
}
boardpantsmcX = boardpantsmc._x;
boardpantsmcY = boardpantsmc._y;
boardpantsmc.onRelease = function(){
if (boardpantsmc.hitTest(pants_pos)){
stopDrag();
this._x=_root.pants_pos._x+(_root.pants_pos._width/2)-(this._width/2);
this._y=_root.pants_pos._y+(_root.pants_pos._height/2)-(this._height/2);
pants2 = 'boardpants';
}else{
stopDrag();
boardpantsmc._x = boardpantsmcX;
boardpantsmc._y = boardpantsmcY;
}
}
boardsocksmcX = boardsocksmc._x;
boardsocksmcY = boardsocksmc._y;
boardsocksmc.onRelease = function(){
if (boardsocksmc.hitTest(feet_pos)){
stopDrag();
this._x=_root.feet_pos._x+(_root.feet_pos._width/2)-(this._width/2);
this._y=_root.feet_pos._y+(_root.feet_pos._height/2)-(this._height/2);
feet1 = 'boardersocks';
}else{
stopDrag();
boardsocksmc._x = boardsocksmcX;
boardsocksmc._y = boardsocksmcY;
}
}
boardbootsmcX = boardbootsmc._x;
boardbootsmcY = boardbootsmc._y;
boardbootsmc.onRelease = function(){
if (boardbootsmc.hitTest(feet_pos)){
stopDrag();
this._x=_root.feet_pos._x+(_root.feet_pos._width/2)-(this._width/2);
this._y=_root.feet_pos._y+(_root.feet_pos._height/2)-(this._height/2);
feet2 = 'boardboots';
}else{
stopDrag();
boardbootsmc._x = boardbootsmcX;
boardbootsmc._y = boardbootsmcY;
}
}
glove1X = glove1._x;
glove1Y = glove1._y;
glove1.onRelease = function(){
if (glove1.hitTest(hand_pos)){
stopDrag();
this._x=_root.hand_pos._x+(_root.hand_pos._width/2)-(this._width/2);
this._y=_root.hand_pos._y+(_root.hand_pos._height/2)-(this._height/2);
glove1 = 'boardglove1';
}else{
stopDrag();
glove1._x = glove1X;
glove1._y = glove1Y;
}
}
glove2X = glove2._x;
glove2Y = glove2._y;
glove2.onRelease = function(){
if (glove2.hitTest(hand_pos2)){
stopDrag();
this._x=_root.hand_pos2._x+(_root.hand_pos2._width/2)-(this._width/2);
this._y=_root.hand_pos2._y+(_root.hand_pos2._height/2)-(this._height/2);
glove2 = 'boarderglove2';
}else{
stopDrag();
glove2._x = glove2X;
glove2._y = glove2Y;
}
}
helmetmcX = helmetmc._x;
helmetmcY = helmetmc._y;
helmetmc.onRelease = function(){
if (helmetmc.hitTest(head_pos)){
stopDrag();
this._x=_root.head_pos._x+(_root.head_pos._width/2)-(this._width/2);
this._y=_root.head_pos._y+(_root.head_pos._height/2)-(this._height/2);
helmet = 'boarderhelmet';
}else{
stopDrag();
helmetmc._x = helmetmcX;
helmetmc._y = helmetmcY;
}
}
hatmcX = hatmc._x;
hatmcY = hatmc._y;
hatmc.onRelease = function(){
if (hatmc.hitTest(head_pos)){
stopDrag();
this._x=_root.head_pos._x+(_root.head_pos._width/2)-(this._width/2);
this._y=_root.head_pos._y+(_root.head_pos._height/2)-(this._height/2);
hat = 'boarderhat';
}else{
stopDrag();
hatmc._x = hatmcX;
hatmc._y = hatmcY;
}
}
checkClothes_btn.onRelease = function(){
trace('top 1: '+ top1 + ' top 2: ' + top2 + ' top 3: ' + top3 + ' pants1: ' +
pants1 + ' pants2: ' + pants2 + ' feet1: ' + feet1 + 'feet2: ' + feet2 +
'glove1: ' + glove1 + 'glove2: ' + glove2 + 'helmet: ' + helmet + hat);
if (top1 == 'boardwickingtop' && top2 == 'boardinsulating' && top3 ==
'boardjacket' && pants1 == 'wickpants' && pants2 == 'boardpants' && feet1 ==