Ah, yes. I've unfortunately overlooked the fact that SetLayer only affects the 'graphical' side of things, whereas the drag drop relies on the 'real' order of things in the tree view, which hasn't changed.
There are two other alternatives that I can think of, one would be to duplicate the page a number of times, reorder the objects on each duplicate and then pick from one of these pages randomly. The other would be to write the drag drop manually, which would be more complicated.
The code for the first solution would be:
Code:
var iNumPages = 10;
function GotoRandomPage()
{
var strPage = "Page " + (Math.round(Math.random()*iNumPages)+1);
GotoPage(strPage);
}
You would need call the function GotoRandomPage() from the appropriate place and substitute the "Page " string.