-
FLASH AS3 RANDOM text No repeatation.
hi,, a new member here, am just starting to learn adobe flash..I have heard some people saying "stop learning it, it's outdated," but I would like to try it first.. I have been making a simple code in ACTIONSCRIPT3, what it does is that it generates a random name from list of array if the Button generate is clicked, It works just fine however I am having a hard time on how can I restrict it from Generating Repeated Name.NO REPEATED NAMES MUST BE GENERATED. THank you and advance, I appreciate any help I could get.
My code goes this way.
[B]import flash.events.MouseEvent;
var names:Array = ["nameA","nameB","nameC","nameD"];
generate.addEventListener(MouseEvent.CLICK,generat eName);
function generateName(event:MouseEvent): void{
var randomSurname= names[int(Math.random() * names.length)];
result.text=randomSurname.toString();
}[/COLOR][/B]
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|