# How to randomize custom Drag Source positions On Load

**URL:** <https://talk.atomisystems.com/t/how-to-randomize-custom-drag-source-positions-on-load/10617>\
**Category:** Support Questions\
**Created:** [October 16, 2026, 10:32pm UTC](https://talk.atomisystems.com/t/how-to-randomize-custom-drag-source-positions-on-load/10617 "2026-10-16T22:32:43Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Betty](https://talk.atomisystems.com/user_avatar/talk.atomisystems.com/betty/32/1413_2.png) [@Betty](https://talk.atomisystems.com/u/Betty)\
**Post date:** [October 16, 2026, 10:32pm UTC](https://talk.atomisystems.com/t/how-to-randomize-custom-drag-source-positions-on-load/10617/1 "2026-10-16T22:32:43Z")

</div>

Hello Team,  
I am creating a custom drag-and-drop interaction in ActivePresenter without using the default quiz block. I chose this approach because I need the draggable objects to hide completely as soon as they are dropped onto the target, regardless of whether the answer is correct or incorrect.  
In this regard, I would like to know if it is possible to randomize the Drag Source objects when the slide starts, simulating the native behavior of standard “Drag-and-Drop” questions.  
I look forward to your reply. Thank you!

ActivePresenter version: 10.6.2  
Operating system: macOS Sequoia 15.7.7

---

<div class="post-metadata">

**Author:** ![Hoanp](https://talk.atomisystems.com/user_avatar/talk.atomisystems.com/hoanp/32/3546_2.png) [@Hoanp](https://talk.atomisystems.com/u/Hoanp)\
**Post date:** [October 19, 2026, 1:58am UTC](https://talk.atomisystems.com/t/how-to-randomize-custom-drag-source-positions-on-load/10617/2 "2026-10-19T01:58:22Z")

</div>

Hi Betty,

You can use a standard **Drag-n-Drop question** for this. Configure the target to accept all Drag Sources, then add a **Hide Object** action for each corresponding source in the **Accept List**. This hides the source immediately when dropped, regardless of whether it is correct or incorrect. You can then enable **Shuffle Answers** to randomize the sources.

Alternatively, if you prefer your custom interaction, try adding the following **Execute JavaScript** action to the slide’s **On Load** event:

```javascript
(function () {
    // Replace these with the names of your Drag Source objects.
    var names = ["Drag_1", "Drag_2", "Drag_3", "Drag_4"];

    var sources = names.map(function (name) {
        var obj = prez.object(name);
        if (!obj) {
            throw new Error("Object not found: " + name);
        }
        return obj;
    });

    var positions = sources.map(function (obj) {
        return { x: obj.left(), y: obj.top() };
    });

    for (var i = positions.length - 1; i > 0; i--) {
        var j = Math.floor(Math.random() * (i + 1));
        var temp = positions[i];
        positions[i] = positions[j];
        positions[j] = temp;
    }

    sources.forEach(function (obj, index) {
        obj.left(positions[index].x);
        obj.top(positions[index].y);
    });
})();

```

Best regards,  
Hoa

---

<div class="post-metadata">

**Author:** ![Betty](https://talk.atomisystems.com/user_avatar/talk.atomisystems.com/betty/32/1413_2.png) [@Betty](https://talk.atomisystems.com/u/Betty)\
**Post date:** [October 19, 2026, 10:40am UTC](https://talk.atomisystems.com/t/how-to-randomize-custom-drag-source-positions-on-load/10617/3 "2026-10-19T10:40:02Z")

</div>

Hi Hoa, I’ve tried using this code, but if you move the objects without dragging them into the drop zone, they behave strangely.  
Anyway, thank you so much for your help. 🙏
