choose a instance name randomly
hey, i want to make a random item visible
how can i do that
can you give me a sample code
thanks
hey, i want to make a random item visible
how can i do that
can you give me a sample code
thanks
Hi fastboy,
[Possibly better in general AS3 discussions]
If you want a random item, you need to know of what group/list.
Keep an array of the items you create in order to later pick a random item out of that list:
//
myArray[ Math.floor( Math.random() * myArray.length ) ]
Otherwise (if items are not placed with code) you could check how many items exists as child of the container and use something like:
container.getChildAt( Math.floor( Math.random() * container.numChildren ) )
Kind regards,
Manno
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.