-
button controlling two movieclips, not working so well
Okay, it's a bit complicated to explain my problem but I'll try!
I made a dress-up game (well a got a lot of help with the coding), a while ago.
And now I want to have the option to change skintones. That's not a problem in it self, I just made two buttons that control the skin-MC. But the problem is that I also have the option to change her feet, from standing on her toes or not. And when I now for example have chosen the dark skin color, and then change the feet to standing on her toes, the skin color of the feet turns to the light skin color.
I don't think it's so difficult to fix, I suppose I have to tell the feet-buttons that "if the skin-color is on
skin1, go to feet1" or something like that, I just can't figure out the code.
I just can't get the file size below 300k, since it's not in vector. And you kind of have to see the girl and the feet to get my problem.. But it's only 390k and you can download it here from my server:
http://www.annagrape.se/style-small.fla
I would be sooo grateful if anyone will help me!
-
.
Hi,
I took a look at your file, this will help you, although I am not sure how it will effect the other items as they were not in the file, replace all of your code on the timeline with this
PHP Code:
var marginal = 70;
var skinType = "1";// added to name skin type from start - 1 for white, 2 for dark
dra = function ()
{
this.startDrag(false);
this.swapDepths(_root.getNextHighestDepth());
};
slapp = function ()
{
this.stopDrag();
if (this._x > -marginal && this._x < marginal && this._y > -marginal && this._y < marginal)
{
trace("snap");
this._x = 0;
this._y = 0;
}
else
{
trace("no snap");
}
};
var hairPlagg:Array = new Array();
var skirtsPlagg:Array = new Array();
var dressesPlagg:Array = new Array();
var bottomsPlagg:Array = new Array();
var topsPlagg:Array = new Array();
var accessoriesPlagg:Array = new Array();
var shoesPlagg:Array = new Array();
var costumesPlagg:Array = new Array();
costumesPlagg.push(cos1);
costumesPlagg.push(cos2);
costumesPlagg.push(cos3);
costumesPlagg.push(cos4);
shoesPlagg.push(shoes1);
shoesPlagg.push(shoes2);
shoesPlagg.push(shoes3);
shoesPlagg.push(shoes4);
hairPlagg.push(hair1);
hairPlagg.push(hair2);
hairPlagg.push(hair3);
hairPlagg.push(hair4);
skirtsPlagg.push(skirt1);
skirtsPlagg.push(skirt2);
skirtsPlagg.push(skirt3);
skirtsPlagg.push(skirt4);
dressesPlagg.push(dress1);
dressesPlagg.push(dress2);
dressesPlagg.push(dress3);
dressesPlagg.push(dress4);
bottomsPlagg.push(bottom1);
bottomsPlagg.push(bottom2);
bottomsPlagg.push(bottom3);
bottomsPlagg.push(bottom4);
topsPlagg.push(top1);
topsPlagg.push(top2);
topsPlagg.push(top3);
topsPlagg.push(top4);
accessoriesPlagg.push(acc1);
accessoriesPlagg.push(acc2);
accessoriesPlagg.push(acc3);
accessoriesPlagg.push(acc4);
for (i = 0; i < shoesPlagg.length; i++)
{
shoesPlagg[i].onPress = dra;
shoesPlagg[i].onRelease = slapp;
shoesPlagg[i].onReleaseOutside = slapp;
}
for (i = 0; i < hairPlagg.length; i++)
{
hairPlagg[i].onPress = dra;
hairPlagg[i].onRelease = slapp;
hairPlagg[i].onReleaseOutside = slapp;
}
for (i = 0; i < skirtsPlagg.length; i++)
{
skirtsPlagg[i].onPress = dra;
skirtsPlagg[i].onRelease = slapp;
skirtsPlagg[i].onReleaseOutside = slapp;
}
for (i = 0; i < dressesPlagg.length; i++)
{
dressesPlagg[i].onPress = dra;
dressesPlagg[i].onRelease = slapp;
dressesPlagg[i].onReleaseOutside = slapp;
}
for (i = 0; i < bottomsPlagg.length; i++)
{
bottomsPlagg[i].onPress = dra;
bottomsPlagg[i].onRelease = slapp;
bottomsPlagg[i].onReleaseOutside = slapp;
}
for (i = 0; i < topsPlagg.length; i++)
{
topsPlagg[i].onPress = dra;
topsPlagg[i].onRelease = slapp;
topsPlagg[i].onReleaseOutside = slapp;
}
for (i = 0; i < accessoriesPlagg.length; i++)
{
accessoriesPlagg[i].onPress = dra;
accessoriesPlagg[i].onRelease = slapp;
accessoriesPlagg[i].onReleaseOutside = slapp;
}
for (i = 0; i < costumesPlagg.length; i++)
{
costumesPlagg[i].onPress = dra;
costumesPlagg[i].onRelease = slapp;
costumesPlagg[i].onReleaseOutside = slapp;
}
visaGarderob = function (vilken)
{
if (shoesPlagg[i]._x != 0 && shoesPlagg[i]._y != 0)
{
shoesPlagg[i]._visible = false;
}
};
for (i = 0; i < hairPlagg.length; i++)
{
if (hairPlagg[i]._x != 0 && hairPlagg[i]._y != 0)
{
hairPlagg[i]._visible = false;
}
}
for (i = 0; i < skirtsPlagg.length; i++)
{
if (skirtsPlagg[i]._x != 0 && skirtsPlagg[i]._y != 0)
{
skirtsPlagg[i]._visible = false;
}
}
for (i = 0; i < dressesPlagg.length; i++)
{
if (dressesPlagg[i]._x != 0 && dressesPlagg[i]._y != 0)
{
dressesPlagg[i]._visible = false;
}
}
for (i = 0; i < bottomsPlagg.length; i++)
{
if (bottomsPlagg[i]._x != 0 && bottomsPlagg[i]._y != 0)
{
bottomsPlagg[i]._visible = false;
}
}
for (i = 0; i < topsPlagg.length; i++)
{
if (topsPlagg[i]._x != 0 && topsPlagg[i]._y != 0)
{
topsPlagg[i]._visible = false;
}
}
for (i = 0; i < accessoriesPlagg.length; i++)
{
if (accessoriesPlagg[i]._x != 0 && accessoriesPlagg[i]._y != 0)
{
accessoriesPlagg[i]._visible = false;
}
}
for (i = 0; i < costumesPlagg.length; i++)
{
if (costumesPlagg[i]._x != 0 && costumesPlagg[i]._y != 0)
{
costumesPlagg[i]._visible = false;
}
}
for (i = 0; i < vilken.length; i++)
{
vilken[i]._visible = true;
}
//}
btn_shoes.onPress = function()
{
visaGarderob(shoesPlagg);
};
btn_hair.onPress = function()
{
visaGarderob(hairPlagg);
};
btn_skirts.onPress = function()
{
visaGarderob(skirtsPlagg);
};
btn_dresses.onPress = function()
{
visaGarderob(dressesPlagg);
};
btn_bottoms.onPress = function()
{
visaGarderob(bottomsPlagg);
};
btn_tops.onPress = function()
{
visaGarderob(topsPlagg);
};
btn_accessories.onPress = function()
{
visaGarderob(accessoriesPlagg);
};
btn_costumes.onPress = function()
{
visaGarderob(costumesPlagg);
};
//make-up
btn_mun1.onPress = function()
{
_root.munnar.gotoAndPlay("mun1");
};
btn_mun2.onPress = function()
{
_root.munnar.gotoAndPlay("mun2");
};
btn_mun3.onPress = function()
{
_root.munnar.gotoAndPlay("mun3");
};
btn_mun4.onPress = function()
{
_root.munnar.gotoAndPlay("mun4");
};
btn_eye1.onPress = function()
{
_root.eyes.gotoAndPlay("eye1");
};
btn_eye2.onPress = function()
{
_root.eyes.gotoAndPlay("eye2");
};
btn_eye3.onPress = function()
{
_root.eyes.gotoAndPlay("eye3");
};
btn_eye4.onPress = function()
{
_root.eyes.gotoAndPlay("eye4");
};
//feet
btn_heels.onPress = function()
{
_root.feet.gotoAndPlay("heels");
// *** added
if (skinType == "1")
{
_root.feet.heels.gotoAndPlay("heels1");
}
else
{
_root.feet.heels.gotoAndPlay("heels2");
}
// *** end added
_root.bottom3.gotoAndPlay("flat");
_root.bottom4.gotoAndPlay("flat");
_root.bottom5.gotoAndPlay("flat");
_root.bottom6.gotoAndPlay("flat");
_root.bottom19.gotoAndPlay("flat");
};
btn_toes.onPress = function()
{
_root.feet.gotoAndPlay("toes");
// *** added
if (skinType == "1")
{
_root.feet.toes.gotoAndPlay("toes1");
}
else
{
_root.feet.toes.gotoAndPlay("toes2");
}
// *** end added
_root.bottom3.gotoAndPlay("toes");
_root.bottom4.gotoAndPlay("toes");
_root.bottom5.gotoAndPlay("toes");
_root.bottom6.gotoAndPlay("toes");
_root.bottom19.gotoAndPlay("toes");
};
//skin
btn_skin1.onPress = function()
{
skinType = "1";// added
_root.skin.gotoAndPlay("skin1");
_root.feet.toes.gotoAndPlay("toes1");
_root.feet.heels.gotoAndPlay("heels1");
};
btn_skin2.onPress = function()
{
skinType = "2";// added
_root.skin.gotoAndPlay("skin2");
_root.feet.toes.gotoAndPlay("toes2");
_root.feet.heels.gotoAndPlay("heels2");
};
visaGarderob(shoesPlagg);
I have commented the bits i added
the flat dark feet were missing from the file too
hope it sorts your problem for you
my hobby
Last edited by fruitbeard; 04-11-2013 at 08:53 AM.
-
oh my god. Thank you SO MUCH! This is exactly what I wanted, it's so annoying when I know what needs to be done but just don't know the code. At least I learn stuff as I go along
I tried it in my file with all the stuff in it, and it works perfectly!
thank you again and again!
-
Oh I forgot to ask. Will this work if I add more skin colors?
Can I just add
Code:
else
{
_root.feet.heels.gotoAndPlay("heels3");
}
for example, or will that mess everything up?
Now it's skin1, else skin2 but i suppose it won't work with if else, else right?
sorry for being such a newbie.. hehe
-
oh nevermind, I actually figured it out by myself. else if! wohoo
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|