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();
Wow.. Thank you very much, Different approach but yields with the same outcome. ,how could I add music to it? It would play a sound every time a random name would be generated.. Any tips I sound do.. I tried adding sound in my button.
var mysound:MySound = new failedplay();
mysound.play();
but an error keeps on appearing.. Scene 1, Layer 'Script', Frame 1, Line 41 1046: Type was not found or was not a compile-time constant: MySound.
What does this mean, Thank you