Flash MX actionscript random number array

Posted on 2007-09-28
Last Modified: 2010-05-19
Hi Experts

I hope that someone can point this code in the right direction for me!

I am developing a hybrid page with php and flash.

I am trying to generate an array of 5 random numbers, that are unique, for a looped flash movie that is displaying info from a database table.

As the Flash file loops it uses the countedvar++ loop to select the next number in the array and pull the data from the database

When I tested this as a simple random number version it all works fine and the page displays the correct text so I am happy that it all works. Now that I am tring to generate a unique number   ....we'll i'm lost.

this code below just gives me  "undefined"

Anyone who can turn this around - big points bonus weekend!!

var txttitle:String = txttitle;

var myArray:Array = txttitle.split(",");

      function randList(M,N) {
      ary = [];
      for (i=1; i<M && N>0; ++i) {
            if (random(M-i)<N) {
var myArray:Array  = randList(12,4);
var txttitle:String = myArray[ary];

if (this.countedVar <= 0) {

else if(this.countedVar < 4) {

} else {
_root.gotoAndPlay ("close");
Question by:imagicstudios
    LVL 34

    Accepted Solution

    problem is in following line of code:

    var txttitle:String = myArray[ary];

    "ary" is an array, how can it be used as index number for array "myArray"

    Aneesh Chopra
    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Recently, I was asked to recommend a tracking system to be implemented on a clients website. As the entire site was built on flash, my first thought was to suggest custom built tracking system. However, our company at that point of time didn't h…
    I have been doing hardcore actionscripting for some time; and needless to say I have faced a lot of problems in just understanding others' code rather than understanding what the code executes. A programmer's life can become hell when there are a lo…
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.
    This Micro Tutorial will teach to how to utilize bit rate in Adobe Flash Media Live Encoder.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    25 Experts available now in Live!

    Get 1:1 Help Now