I have the code for both character random and skin buttons:
var HaurkaWS: Haurka_Wetsuit = new Haurka_Wetsuit();
var MinamiWS: Minami_Wetsuit = new Minami_Wetsuit();
var MinamiSWS: Minami_ShortWetsuit = new Minami_ShortWetsuit();
var KiraraWS: Kirara_Wetsuit = new Kirara_Wetsuit();
var TowaWS: Towa_Wetsuit = new Towa_Wetsuit();
var HaurkaSS: Haurka_Swimsuit = new Haurka_Swimsuit();
var MinamiSS: Minami_Swimsuit = new Minami_Swimsuit();
var KiraraSS: Kirara_Swimsuit = new Kirara_Swimsuit();
var KiraraBS: Kirara_Bikini = new Kirara_Bikini();
var TowaSS: Towa_Swimsuit = new Towa_Swimsuit();
For Character Button:
var characterRandom: String;
var characterRandomArray: Array = [HaurkaWS,MinamiWS,KiraraWS,TowaWS];
var HaurkaSkin: Array = [HaurkaWS,HaurkaSS];
var MinamiSkin: Array = [MinamiWS,MinamiSS,MinamiSWS];
var KiraraSkin: Array = [KiraraWS,KiraraSS,KiraraBS];
var TowaSkin: Array = [TowaWS,TowaSS];
character_btn.addEventListener(MouseEvent.CLICK, on_pressCharacter);
function on_pressCharacter(e: MouseEvent): void {
if(contains(DisplayObject(character)))
{
character = characterRandomArray.splice(int(Math.random() * characterRandomArray.length));
}
}
For Skin button:
skin_btn.addEventListener(MouseEvent.CLICK, on_pressSkin);
function on_pressSkin(e: MouseEvent): void {
if(character == contains(DisplayObject(characterRandomArray[0])) && contains(DisplayObject(HaurkaSkin[0]))){
var randomHaurkaSkin = HaurkaSkin.splice(int(Math.random() * HaurkaSkin[0].length));
}
else if(character == contains(DisplayObject(characterRandomArray[1])) && contains(DisplayObject(MinamiSkin[0])))
{
var randomMinamiSkin = MinamiSkin.splice(int(Math.random() * MinamiSkin[0].length));
}
else if(character == contains(DisplayObject(characterRandomArray[2])) && contains(DisplayObject(KiraraSkin[0])))
{
var randomKiaraSkin = KiraraSkin.splice(int(Math.random() * KiraraSkin[0].length));
}
else if(character == contains(DisplayObject(characterRandomArray[3])) && contains(DisplayObject(TowaSkin[0])))
{
var randomTowaSkin = TowaSkin.splice(int(Math.random() * TowaSkin[0].length));
}
}
And then I have 2 errors:
TypeError: Error #1034: Type Coercion failed: cannot convert []@26f82b72b21 to Haurka_Wetsuit.
at WetWorldChallenge_fla::MainTimeline/on_pressCharacter()[WetWorldChallenge_fla.MainTimeline::frame491:148]
TypeError: Error #2007: Parameter child must be non-null.
at flash.display::DisplayObjectContainer/contains()
at WetWorldChallenge_fla::MainTimeline/on_pressSkin()[WetWorldChallenge_fla.MainTimeline::frame491:157]
I was unable to change character or the skin, any ideas how to fix these?
Aucun commentaire:
Enregistrer un commentaire