Copy/duplicate array! (Concat and slice not working!)

Heey guys!

I’m working on programming some sort of weekagenda. I built this week from arrays. You have an arrayWeek, with in it arrayMonday (being arrayWeek[0]), arrayTuesday (arrayWeek[1]), …, arraySunday (being arrayWeek[6])… All days are arrays themselves, they all contain different ‘temps’ (as i called them)… So you can have arrayWeek[3][2], being the third ‘temp’ of thursday. All this is in the class Program. Well, I hope you understand what I mean!

Now, I want to be able to copy a day. So at some point I want tuesday to be the same as monday, but when altering monday afterwards, tuesday has to stay the same (not be altered like monday)… I searched Kirupa and found http://www.kirupa.com/developer/actionscript/tricks/arrayduplication.htm, but it didn’t work! Still, the other day also is changed when changing the first one!

Here’s (part of) my code:


program.arrayWeek[dayNumber] = []; //emptying the array first
for(var j:Number = 0; j < program.arrayWeek[asDayNumber].length; j++){
program.arrayWeek[dayNumber][j] = program.arrayWeek[asDayNumber][j].concat();
}

“dayNumber” is the current day, the one that has to change. “adDayNumber” is the day currentDay has to be the same to…

I also tried the same without the forloop and [j] part, so trying to copy the whole day at once… Also no result!

De copying itself works, but they stay referenced to the same array… Maybe there is a workaround the concat and slice functions?

Thanks!
MarMel