Page 1 of 1

setting polygon points

Posted: Sun Dec 21, 2014 10:58 pm
by Randall Lee Reetz
I've put the following code into a button's script:

on mouseUp
put "100,100,200,200,100,500" into myPoints
set the points of graphic "myPoly" to myPoints
end mouseUp

There is of course a polygon on the same card named "myPoints"

But when I click on the button, nothing happens.

What is up???

Re: setting polygon points

Posted: Sun Dec 21, 2014 11:10 pm
by Klaus
Hi Randall,

try this:
...
put "100,100" & CR & "200,200" & CR & "100,500" into myPoints
...
If in doubt, ALWAYS consult the dictionary first! 8)


Best

Klaus

Re: setting polygon points

Posted: Mon Dec 22, 2014 1:37 am
by Randall Lee Reetz
I tried that. But without the space characters between. Didn't work. The dictionary says that you can "set" points from comma delineated lists... but "put" points always returns lines of x,y pairs.

Re: setting polygon points

Posted: Mon Dec 22, 2014 1:40 am
by Klaus
You're welcome! 8)

Re: setting polygon points

Posted: Mon Dec 22, 2014 5:29 pm
by jacque
Commas used to work but somewhere along the line I read they stopped working. At any rate, I assume that "myPoints" is a typo and the name of the graphic is really "myPoly", right?