If you're using AS3, everything in your library that's set to export
for Actionscript will have a unique Class which you need to call to
instantiate it.
Use getDefinitionByName to turn a randomly selected string into a
class definitiion and then call it.

Example:

If your library has 50 objects and their named: Card1, Card2, Card3 and so on.

var cardName:String = "Card"+String(1 + uint(Math.random()*49));
var cardClass:Object = getDefinitionByName(cardName) as Object
var card:Sprite = new cardClass();

The last line you can substitue your classes and parameters. Then run
this code 7 times.

2008/6/30 Bassam M <[EMAIL PROTECTED]>:
> Hi
>
> I'm trying to make game in this game I have 50 movie clip in the library
> I want when I click on one button call draw i want to show 7 of this movie
> clips on the stage but i want to select randomly 7 of 50 or more or once i
> click draw i want to draw one card  by one random
> can anyone help me please how to do it
>
> Tank you
> Bassam
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>



-- 
Random Lines 3D
My online portfolio
www.therandomlines.com
_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to