Language: ChineseGermanSpanishFrenchDutchItalianRussian
123 Flash Chat Forums

Go Back   TOPCMM Community > SWFKit > SWFKit Bug Report

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 09-22-2003, 08:28 PM
Junior Member
 
Join Date: Sep 2003
Posts: 2
Default associativ array ?

Sorry if it was already posted, i'm new here.

I don't know ECMA specification about this, but it seems that associativ arrays are not supported in FFish ( they are in Actionscript and Javascript ).

Are you planning to support it ?

Code:
var _array = new Array();
_array[ 3 ] = 123; // ok
_array[ "test" ] = 456; // error (invalid index)
Thanks, and bravo for the great work
M.
Reply With Quote
  #2 (permalink)  
Old 09-25-2003, 03:45 PM
Senior Member
 
Join Date: Dec 2002
Posts: 2,015
Default Re:associativ array ?

Hi,

Sorry, SWFKit does not support it.
Reply With Quote
  #3 (permalink)  
Old 09-26-2003, 04:20 AM
RJS RJS is offline
Member
 
Join Date: Sep 2003
Posts: 56
Default Re:associativ array ?

Haven't tried this yet, but I think it may work??
ie Use an Object object , rather than an Array object.

var _array = new Object();
_array[ "test" ] = 456;

Reply With Quote
  #4 (permalink)  
Old 09-26-2003, 07:00 AM
RJS RJS is offline
Member
 
Join Date: Sep 2003
Posts: 56
Default Re:associativ array ?

Below some further explorations: This approach seems to work and provides a useful basis for some data structures.

var objArray = new Object();
objArray[1] = 1;
objArray[2] = 2;
objArray[3] = 3;
objArray['index1'] = 'string_1';
objArray.index2 = 'string_2';


trace (objArray[1]);
trace (objArray['index1']);
trace (objArray.index2);

objArray.index3 = objArray[3];
for (var ndx in objArray) {
trace(ndx + ':' + objArray[ndx]);
}

Trace:

1
string_1
string_2
__proto__:3
index3:3
index2:string_2
index1:string_1
Reply With Quote
Reply

Was this information helpful?    Yes No



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 11:07 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.1.0 ©2007, Crawlability, Inc.