General Intersect

TJ Frame tjframe at gmail.com
Mon Aug 22 08:50:25 EDT 2005


Aso, If you might end up intersecting more than one button, you could create 
a subset list of all buttons that match with something like the following:
 put 1 into counter
 repeat for the number of btns
 if the number of btn "targetButton" = counter then next repeat
 if intersect(button "targetButton", btn counter) then put the short id of 
btn counter & cr after hitList
 add 1 to counter
end repeat
 --- each line of hitList will contain the id of a btn that intersects with 
your target button
  this runs pretty fast. On my system, searching through 850 buttons took 18 
milliseconds on average

 On 8/22/05, Malte Brill <revolution at derbrill.de> wrote: 
> 
> Hi Roger,
> 
> as saied before you would do this with a repeat structure.
> 
> eg:
> 
> repeat with i=1 to the number of buttons
> if the short name of btn i="targetButton" then next repeat
> if intersect(btn "targetButton", btn i) then
> --do stuff
> end if
> end repeat
> 
> However, if it is a time critical script and you have many buttons to
> check, I suggest that you store the ID of all buttons you need to check
> in a custom property and use repeat for each from there:
> 
> Assuming you have stored the IDs in a customProperty called
> allButtonsToCheck, each ID on a seperate line:
> 
> repeat for each line theButtonToCheck in the allButtonsToCheck of this
> card
> if theButtonToCheck=the ID of button "targetButton" then next repeat
> if intersect(button "targetButton", button ID theButtonToCheck) then
> --do stuff
> end if
> end repeat
> 
> All the best,
> 
> Malte
> 
> 
> ---
> ArcadeEngine - prepare to WOW your audience within minutes
> http://www.runrev.com/section/revselect/arcadeengine
> http://www.derbrill.com/arcadeengine/forum
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your 
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution
>



More information about the use-livecode mailing list