how to create if statement when 4 mc are visible


hi

i create matching game between mcs

so usre click between 2 mc line show

 

i wont use if statement use when 4 lines visible ( mean user finish game , connect right )

var all:array;

 

here's code used

 

all = [line,line2,line33];

 

 

if (all.alpha == 0)

{

          trace("ya");

}

 

but nothing happen !!

//an array no displayobject, has no alphachannel.

 

//for testing contents of array use:

 

function testifallvalid():boolean

{

 

    var counter:int = 0;

 

    (var i:int; < all.length; i++)

    {

 

        if (all[i].alpha == 1)

        {

 

            counter++;

 

        }

 

    }

 

    if (counter == all.length)

    {

 

        return true;

 

    }

 

    else

    {

 

        return false;

 

    }

 

}

 

// use if(testifallvalid()) condition winning state

 

i wont use if statement use when 4 lines visible

there differnce between visible property , alpha channel property of displayobject

it depends how setting displayoptions of mcs in beginning of game

if set visible properties false, alpha-property still 1

if set alpha properties 0 , check visible properties, still true



More discussions in ActionScript 3


adobe

Comments

Popular posts from this blog

Embed interactive SWF in PDF - losing interactivity

Falang and too many redirects - Joomla! Forum - community, help and support

bonjour sur reader comment je change mon imprimante par defaut