actionscript 3 - swapChildrenAt, setChildIndex, swapChildren all duplicating MC's -
first time poster here.
this issue reproducible on machine new .fla project in actionscript 3.0 in flash professional cs5. it's edit of original question more information.
i'm working on project load external swf's , search through instance names matching keywords, namely 'drag' , 'drop' identify movieclip matches, attach event listeners these mc's contain d&d event listeners , code.
the specific problem switching of depths movieclips nested in dynamically loaded external swf files.
where having trouble specific commands:
swapchildrenat, setchildindex, swapchildren, removechild/addchild. i've tried 4 same problem of duplication. let me explain.
when draggable mc clicked, moved top index of dynamically loaded swf it's visible above else in swf. problem trying of these commands duplicate mc. happens this:
mouse_down event fires: index of target mc recorded '2', index switch '20' (maximum index of swf) setchildindex called on target mc parent: mc.parent.setchildindex(mc, (mc.parent.numchildren-1)) mc moves index 20 instance of mc created @ layer located (index 2)
this duplicate has been confirmed using event.added_to_stage listener attached stage catch every object of movieclip types added stage. i've inspected swf confirm there's no duplicate movieclips, traces confirm this.
there similar posts around web mentioning same problem no solutions.
similar posts mention same duplication problem no 1 has solution i've found work in case.
http://www.kirupa.com/forum/showthread.php?t=359452 http://board.flashkit.com/board/showthread.php?t=775200 http://forums.adobe.com/thread/199983
as last note, if comment out index swap statement, code works mc staying on lower z-index instead of being on top. unfortunately that's not going work solution since i'm not building external swf's.
thanks , regards cameron
one quick way of bypassing setchildindex/swapchildrenat/etc, if possible in framework, removechild , addchild (your mc), guarantee it's highest.
just suggestion. hope helps.
Comments
Post a Comment