Skip to main content
Participating Frequently
September 22, 2008
Question

splice array, reposition MCs & save to sharedObject

  • September 22, 2008
  • 1 reply
  • 324 views
I drag & drop MovieClips onto a 'map', they leave a duplicate MC which is stored in a sharedObject (name, coords), users can then reposition the Mcs and/or delete some, info re the new coords & MCs deleted is saved again to sharedObj. Prob is that when I delete some MCs, THEN reposition those remaining, THEN refresh the browser (simulating a save - as if user returns after having closed browser) - the icons are in original position - not where I moved them to. This doesn't happen if I press refresh after deleting, THEN reposition MCs.
Any ideas where I'm going wrong.
Attached this section of code in case anyone can spot something - my first try at sharedObjects & splice array!
This topic has been closed for replies.

1 reply

Inspiring
September 22, 2008
I won't pretend to have read all your code, but my guess is that you should iterate backward through your array. If you go through forward when removing things from an array your index will get "lost" because array.length will be changing. So I'm thinking:

for (r=aSavedMapIcons.length-1; r>=0; r--)

Maybe?