Hi Mark,
It would seem that you have a variable and function named the same. I would recommend changing one of these as it will reduce any confusion if they are used extensively though out your script (e.g. replace tLocList with gLogList)
In regards to your script, it would seem that you are generating a list of your buttons pre-existing locations and then assigning the loc buttons to a random value from this list. If this is the case, then the position of the buttons will not change as all positions are pre existing. Only the buttons present in those positions will change.
You are also not calling your function tLocList anywhere so this will not be doing anything. The function also seems to be slightly wrong as well as you cannot set the location of a variable.
If you want to randomly generate buttons on your stack, then the easiest option would be something like
Code: Select all
on preOpenCard
repeat with i = 1 to 10
create button
set the name of the last button to "button"&&i
set the loc of the last button to random(the width of this stack),random(the height of this stack)
end repeat
end preOpenCard
From this, you should be able to use the intersect function to check if a button is overlapping and then deal with it accordingly.
Kind Regards,
Neil Roger
--
RunRev Support Team ~
http://www.runrev.com
——