isn't a whole whack of difference. *Maybe* there's a difference in the
Macromedia would know that for sure. In fact, the way that objects can
Dan wrote:
>Patrick,
>
>Yes, I understand HOW to find those names, I'm just asking what the
>diffence is between adding named items to an array and just adding them
>to an object. You said in a previous statement that there were a whole
>bunch of methods available for items in an array. I say that I only can
>find one that will manipulate named array items.
>
>As for how you sort them I would assume there would be SOME way. My
>suggestion would be that they gain an index number as well as a name.
>This is how director differentiates properties in a property list. A
>property list would be something like:
>
>pList=[#name="Dan, #age=26, #fortification="vitamins and minerals"]
>
>Any of the properties in the list can accessed via either pList.itemName
>or pList[indexNumber]. Obviously this is not the case with Flash, just
>an expample. The point being there could be a way to sort them. But
>the real question on my mind is again this:
>
>How is a Named Array Element different from an Object Property?
>
>I've so difference (beyond sortOn()... which isn't much) to show me that
>the Named Array is really anything. What is it I'm missing? Why would
>a named Array be special enough to warrant being called a separate
>element when compared w/ the broad object element?
>
>Cheers,
>Dan
>
>In <cjkdiv$jfj$1@forums.macromedia.com> Patrick Bay wrote:
>
>
>>Dan,
>>
>> I guess the problem is that you're dealing with abstract data.
>>When you ask Flash to sort, reverse, or slice the array, it doesn't
>>make any sense. Sort by what? Slice by what index? If I gave you a
>>list of names and put them into random containers and then told you
>>to sort those containers, how would you do it? You could do it
>>alphabetically, numerically, string length, the order of insertion
>>etc. Of course those functions won't do anything.
>>
>> When you refer to an array class that "does work", what do you
>>mean? What do you expect it to do?
>>
>>By the way, it's very easy to see the contents of named arrays:
>>
>>for (item in myArray) {
>> trace (myArray[item]);
>>}
>>
>>Regards,
>> Patrick
>>
>>-----------------------------------------------------
>>
www.baynewmedia.com >>
>>IRC (
www.dal.net) -> #baynewmedia
>>-----------------------------------------------------
>>
>>
>>
>>Dan wrote:
>>
>>
>>
>>>patrick,
>>>Here.. this is what I did as a test.
>>>
>>>var myArray:Array = new Array(); myArray['name'] = "dan"; myArray[
>>>'age'] = 26; trace(myArray); trace(myArray).reverse(); trace(myArray).
>>>sort(); trace(myArray.age); trace(myArray.name); trace(myArray.slice(1,
>>>2)); trace(myArray.push("Mustache")); trace(myArray.length); as you
>>>can tell by running it, using any of those array classes does nothing
>>>to the elements of my named array. The push essentially adds an
>>>element to the array. The items are still there but you cannot
>>>utilize the classes making them no better than a Object property. Is
>>>there an array class that DOES work with the named array that i'm
>>>missing? The only thing I've found thus far that lets me work even
>>>remotely w/ the named arrays is the sortOn() Method. Here's a quote
>>>
>>>
>>>from the book Macromedia Flash MX 2004 Professional Unleashed:
>>
>>
>>>"Naming array elements is an easy way to keep information organized
>>>within an array. None of these named elemnts can be manipulated by
>>>array methods, nor can they be seen when the array is traced." What
>>>then is the point of named arrays as opposed to using object
>>>properties, aside from the sortOn() command? Cheers, Dan
>>>
>>>
>>>