Associative Array, not array.

Basically, he means Flash's Object.

var o = {};
o.prop = "val";

----- Original Message ----- 
From: "Andreas Rønning" <[EMAIL PROTECTED]>
To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
Sent: Wednesday, November 09, 2005 10:45 AM
Subject: Re: [Flashcoders] removing a entry from an associative array?


Delete won't actually remove the element of the array. Itll just remove
whatever was in it. So if your array was length 3 before, it'll still be
length 3 after delete.

function deleteThisFromArray(a:Array, o:Object):Boolean{
    for(var i = a.length;i--;){
       if(a[i]==o){
          a.splice(i,1);
          return true;
       }
    }
    return false;
}

David Skoglund wrote:

> Thanks Muzak, I have never used the delete command! I always set
> references to null etc.
>
> /David
>
> ----- Original Message ----- From: "Muzak" <[EMAIL PROTECTED]>
> To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
> Sent: Wednesday, November 09, 2005 4:14 PM
> Subject: Re: [Flashcoders] removing a entry from an associative array?
>
>
>> delete??
>>
>> function removeAssociativeEntry (startArray, entryName) {
>>    delete startArray[entryName];
>> }
>>
>> regards,
>> Muzak
>>
>> ----- Original Message ----- From: "David Skoglund"
>> <[EMAIL PROTECTED]>
>> To: "Flashcoders mailing list" <flashcoders@chattyfig.figleaf.com>
>> Sent: Wednesday, November 09, 2005 3:50 PM
>> Subject: [Flashcoders] removing a entry from an associative array?
>>
>>
>> The only solution I see is to create a new array by looping through
>> the array like this:
>>
>> function removeAssociativeEntry (startArray, entryName) {
>>    newarray=[];
>>    for (var i in StartArray) {
>>        if (entryName<>i) {
>>            newarray [i]=startArray[i];
>>        }
>>    }
>>    return (newarray);
>> }
>>
>> This seems a bit silly, especially since I don't know how long these
>> arrays are gonna be. Is thery any inbuilt function for getting the
>> index of a associative entry?
>>
>> /David
>>
>>
>> _______________________________________________
>> Flashcoders mailing list
>> Flashcoders@chattyfig.figleaf.com
>> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>>
>
> _______________________________________________
> Flashcoders mailing list
> Flashcoders@chattyfig.figleaf.com
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders


_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders 

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to