A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: deleting double items in array??

  1. #1
    Junior Member
    Join Date
    Feb 2001
    Posts
    23

    deleting double items in array??

    hi there...

    i cannot use a databse for this project that would make it much more easier for me to solve this problem but i am sure it's not too
    difficult only in flash too...here#s the point

    i have this array storing values to external swf. like this:
    01,02,03,03,02,05,03,02,02,...

    they are displayed on two ways(take a look at the sample!) in textform an on illustration...

    what i want to do is just filter out the one that are double because they are of no interest for me in the textfields...

    examples:
    www.cebes.de/00_test/xm/test.swf

    source
    ---------------------------------------------------------------
    myArray1 = workflow1.split(";");
    for (var i = 0; i<myArray1.length; i++) {
    myArray1[i] = myArray1[i].split(":");
    }

    myArray2 = daten.split(";");
    for (var i = 0; i<myArray2.length; i++) {
    myArray2[i] = myArray2[i].split(":");
    }

    x = 0;
    aa = 1;

    for (m=0; m<myArray2.length; m++) {

    _root.admin.modul01.duplicateMovieClip("0"+aa, aa);
    mennam1 = "0"+aa;
    symbol = myArray2[m][0];

    _root.admin[mennam1].loadMovie(symbol);
    // leveller = "_level"+((100)-m*2);
    _root.admin[mennam1].id = Number(myArray2[m][1]);
    _root.admin[mennam1]._x = Number(myArray2[m][3]);
    _root.admin[mennam1]._y = Number(myArray2[m][4])-150;
    aa += 1;

    for (n=0; n<myArray1.length; n++) {
    if ((myArray1[n][1] == myArray2[m][1])) {

    x += 1;
    _root.components0.comp0.comp1.duplicateMovieClip(" comp0"+x, x);
    comp = "comp0"+x;

    _root.components0.comp0[comp].id = _root.myArray1[n][0];
    _root.components0.comp0[comp].text = _root.myArray1[n][3];
    _root.components0.comp0[comp].typ = _root[comp].text;
    _root.components0.comp0[comp]._y += 12*x;

    myArray3.push(myArray2[n][1]+"1");
    laenge += 3;
    }
    }

    }
    cebe:::::::::

  2. #2
    Junior Member
    Join Date
    Feb 2001
    Posts
    23

    solution

    thanks to senocular and prototype i found a solution. it's pretty easy and like allways much easier than all the work i was figuring out before....check this...



    for(var y=0;y<myArray3.length;++y){
    for(var z=(y+1);z<=myArray3.length;++z){
    if(myArray3[y]==myArray3[z]){
    myArray3.splice(z,1)
    }
    }
    }

    cebe:::::::::

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