Go Back   CodingForums.com > :: Client side development > Flash & ActionScript

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-29-2009, 10:50 AM   PM User | #1
udjamaflip
Regular Coder

 
Join Date: Mar 2008
Posts: 235
Thanks: 6
Thanked 21 Times in 20 Posts
udjamaflip is an unknown quantity at this point
Resolved: Array assignment error in AS2 - Simple bug

Hi guys,

Here is the piece of code which doesn't seem to work:

Code:
lang_array[i]['eng'] = english;
lang_array[i]['pol'] = polski;
lang_array[i]['de'] = deutsch;
trace(english);
trace(i);
trace(lang_array[i]['eng']);
the trace from this (it loops through 3 times)

Code:
This is a transcript..
0
undefined
This is a transcript2..
1
undefined
This is a transcript3..
2
undefined
further up in the code is this:
Code:
//added in to support multilingual transcripts
var lang_array:Array = [];
Any ideas why this is failing and the final trace doesn't output anything? I'm fairly new to AS so if you need more than what i've given let me know.

hope someone can help!
__________________
Andrew Sharman
Web designer, developer and programmer.

If you found my post helpful, why not give thanks! :)
udjamaflip is offline   Reply With Quote
Old 07-29-2009, 10:35 PM   PM User | #2
gnomeontherun
Senior Coder

 
gnomeontherun's Avatar
 
Join Date: Sep 2007
Location: Houston
Posts: 2,846
Thanks: 10
Thanked 238 Times in 229 Posts
gnomeontherun will become famous soon enoughgnomeontherun will become famous soon enough
Assuming that english polski und deutsch are variables with data associated with them, that shouldn't be the problem. I feel like multidimensional arrays like their keys to be index with numbers, have you tried this?

Code:
lang_array[i][0] = 'english';
lang_array[i][1] = 'polski';
lang_array[i][2] = 'deutsch';
trace(english);
trace(i);
trace(lang_array[i][0]);
Also it might make more sense to establish your array like this

Code:
//added in to support multilingual transcripts
var lang_array:Array = new Array();
There are several ways to setup your arrays, depending on how you want to store the data.

http://livedocs.adobe.com/flash/9.0/...=00000091.html
__________________
jeremy - gnomeontherun
Educated questions often get educated answers, and simple questions often get simple answers.
gnomeontherun is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

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

Forum Jump


All times are GMT +1. The time now is 12:34 AM.


Advertisement
Log in to turn off these ads.