Hi!
I’ve made serveral buttons, which display text if they’re clicked. When all the buttons are clicked, a movieclip has to become visible. In code I’ve come to this, but I can’t get the ckeck-function right (below). It seems to me that I’ve done everything right, but it doesn’t work properly… How can I get it working?
Thanks!
var txtArray:Array = [txt_begin, txt_appel, txt_peer, txt_banaan];
var btnArray:Array = [begin, appel, peer, banaan];
var vinkArray:Array = [1, 0, 0, 0];
txt_begin.visible = true;
mc_vinkje.visible = false;
for(var i:int = 0; i < txtArray.length; i++)
{
txtArray*.visible = false;
txt_begin.visible = true;
}
for(var j:int = 0; j < btnArray.length; j++)
{
btnArray[j].visible = true;
btnArray[j].addEventListener(MouseEvent.MOUSE_DOWN, onBTNklik);
begin.visible = false;
}
function onBTNklik (event:MouseEvent):void
{
var len:uint = Math.min(txtArray.length,vinkArray.length);
for(var i:int = 0; i < len; i++)
txtArray*.visible = false;
begin.visible = true;
vinkArray*++;
var currentBTN:String = event.currentTarget.name;
var currentTXT:DisplayObject = getChildByName ("txt_" + currentBTN);
if (txtArray* == btnArray*)
{
currentTXT.visible = true;
}
if (currentTXT == txt_begin)
{
begin.visible = false;
}
vinkcheck();
}
function vinkcheck ():void
{
for(var i:int = 0; i < vinkArray.length; i++)
if (vinkArray[1] != 0)
{
mc_vinkje.visible = true;
}
}
It is now programmed that the MC should become visible when just one button is clicked, but it should be all three. I just wanted to test it with one, but even that doesn’t work.