PDA

View Full Version : Drag & Drop - Depth Challenge



newAS
July 20th, 2005, 06:59 PM
I wonder if someone could help me. I am building a drag & drop question using the Quiz Component that comes as part of Flash MX 2004 Professional.

My problem is that 1 have 3 images therefore 3 targets yet 2 need to be on top of each other, as items need to be placed on top of each other in the correct order.

I need to be able to click item 1 and drag over to target 1, then when released force that depth of item 1 to the bottom. Next click item 2, well this doesn't really matter because it is a larger area and is lower down so not a problem, but the last item 3 needs to be able to see target 3, which would normally be under target 1.

The dragable movie clips are called Drag1, Drag2 & Drag 3 and the target movie clips are called Target1, Target2 & Target3. All of these movie clips are contained within one movie clip called DragDrop on the main timeline.

I pray to the Gurus of ActionScript to see if this can be done, any example or quidance would be much appreciated.

I have an example which can be found at www.iglooweb.co.uk/test/test.zip (http://www.iglooweb.co.uk/test/test.zip) I have abit of AS on the drag button to colour the target area so that I know I am addressing the correct target but the AS to getNextHighestDepth(); does not seem to be working. I have also tried swapping depths, that doesn't seem to work properly either.

Please help.

stringy
July 21st, 2005, 10:41 AM
I wonder if someone could help me. I am building a drag & drop question using the Quiz Component that comes as part of Flash MX 2004 Professional.

My problem is that 1 have 3 images therefore 3 targets yet 2 need to be on top of each other, as items need to be placed on top of each other in the correct order.

I need to be able to click item 1 and drag over to target 1, then when released force that depth of item 1 to the bottom. Next click item 2, well this doesn't really matter because it is a larger area and is lower down so not a problem, but the last item 3 needs to be able to see target 3, which would normally be under target 1.

The dragable movie clips are called Drag1, Drag2 & Drag 3 and the target movie clips are called Target1, Target2 & Target3. All of these movie clips are contained within one movie clip called DragDrop on the main timeline.

I pray to the Gurus of ActionScript to see if this can be done, any example or quidance would be much appreciated.

I have an example which can be found at www.iglooweb.co.uk/test/test.zip (http://www.iglooweb.co.uk/test/test.zip) I have abit of AS on the drag button to colour the target area so that I know I am addressing the correct target but the AS to getNextHighestDepth(); does not seem to be working. I have also tried swapping depths, that doesn't seem to work properly either.

Please help.
you can use swapDepths()
just swap each with 1000
eg/_root.drag.Target1.swapDepths(1000);

newAS
July 22nd, 2005, 10:18 AM
you can use swapDepths()
just swap each with 1000
eg/_root.drag.Target1.swapDepths(1000);

I took your advice and added the similar code to the Drag element as well to ensure that was higher than the drag, for example:

_root.drag.Drag2.swapDepths(1000);
_root.drag.Target2.swapDepths(999);

That works a treat now, however it has introduced a new problem. It means that the user can get this right no matter in what order they do this they, but they need to move Drag1, then Drag2 and finally Drag3 so they should be stacked on top of each other with 3 being at the top and 1 at the bootm.

Is there any way of adding some AS to check that the final order is correct?

Many thanks for your assistance.