dcsimg
A Flash Developer Resource Site

Results 1 to 6 of 6

Thread: [f8]

  1. #1
    Junior Member
    Join Date
    Apr 2008
    Posts
    17

    [f8]

    I havetough nut to crack...

    I have four arrays in each of them I have two sounds indentifiers if 4 diffrent configurations:

    first one (doorOpening,clockTicking)
    second(clockTicking,doorOpening)
    third(clockTicking,clockTicking)
    fourth(doorOpening,doorOpening)

    and the situation is like that:
    I need them to play randomly one by one but... after each two sounds (one whole array) i need to evaluate reaction from someone with impaired hearing
    Two possible reactions: one reaction is that ok I've haerad two diffrent sounds so I have to click this button or second possibility ok those sounds were the same I have to click another buttom...

  2. #2
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    to select one array at random, add all arrays to a master array, randomise the master.
    PHP Code:
    arr1 = ["doorOpening","clockTicking"];
    arr2 = ["clockTicking","doorOpening"];
    arr3 = ["clockTicking","clockTicking"];
    arr4 = ["doorOpening","doorOpening"];

    arrM = [arr1,arr2,arr3,arr4];
    arrM.sort(function(){return Math.floor(Math.random()*3)-1});

    seq00 arrM[0][0]; 
    seq01 arrM[0][1]; 
    trace(seq00+", "+seq01+"\n...........");

    seq10 arrM[1][0]; 
    seq11 arrM[1][1]; 
    trace(seq10+", "+seq11+"\n...........");

    seq20 arrM[2][0]; 
    seq21 arrM[2][1]; 
    trace(seq20+", "+seq21+"\n...........");

    seq30 arrM[3][0]; 
    seq31 arrM[3][1]; 
    trace(seq30+", "+seq31+"\n-----------"); 

  3. #3
    Junior Member
    Join Date
    Apr 2008
    Posts
    17
    Thank You very much for Your quick reply now I'm processing Your code

  4. #4
    Junior Member
    Join Date
    Apr 2008
    Posts
    17
    ok everything works fine and now I wolud like to
    sort my master array x- times so would should I do in such case?

    assuming that I have input text named "numberOfIterations"

    var x:Number = Number(numberOfIterations_txt.text);



    and as a result i want to have master arrays:

    arrM0
    arrM1
    .
    .
    .
    arrM+x

    is it possible?

  5. #5
    FK'n_dog a_modified_dog's Avatar
    Join Date
    Apr 2003
    Location
    "aaarf"
    Posts
    9,176
    not certain where you are heading with this from your question.
    if you wish to loop and create arrays -
    PHP Code:
    for(var n=0;n!=4;n++){
    this["arrM"+n] = new Array();
    }

    /* produces-
    Variable _level0.arrM0 = [object #1, class 'Array'] []
    Variable _level0.arrM1 = [object #2, class 'Array'] []
    Variable _level0.arrM2 = [object #3, class 'Array'] []
    Variable _level0.arrM3 = [object #4, class 'Array'] []
    */ 

  6. #6
    Junior Member
    Join Date
    Apr 2008
    Posts
    17
    this is exacly what I want
    thank You very very much

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center