At 17:02 10/03/2003, you wrote:
At 15:15 10/03/2003, you wrote:

Hi all

I've got a teacher making games using Flash MX, and he asked me if I had
any code for generating an array with the numbers 1 thru 4 in a random
order. It's used to place Flash objects in random locations when the
student loads the game. As it turns out, I had exactly the code he needs,
but Flash Actionscript appears to be either C or C++. Is there a scripting
guru out there who can translate this for me?

I've seen that some of the replies you've got are indeed conversions to C.


HOWEVER, ActionScript is NOT C or C++
It's an entirely seperate language (although, it's syntax appears similar to C)


If I get a chance later tonight, I could probably whip up a routine...


Ok, here is the actionscript code you'll want:

//--- code start
myArray = new Array();

for (var x = 1; x <= 50; x++) {
  num = Math.round(Math.random()*3)+1;
  myArray[x] = num;
}
//--- code end

Hope this helps...

Reply via email to