Code: Select all
on moveRectDist x
set movespeed to 300
move the target to the loc of grc ("Rectangle" & x)
put getX(the target) into field "Field1"
put getY(the target) into field "Field2"
end moveRectDist
function getX input
return item 1 of the loc of input
end getX
function getY input
return item 2 of the loc of input
end getY
But if instead of using the target, I use the explicit graphic in question, I get an error.
Code: Select all
on moveRectDist x
set movespeed to 300
move the target to the loc of grc ("Rectangle" & x)
put getX(grc "Rectangle1") into field "Field1"
put getY(the target) into field "Field2"
end moveRectDist
Code: Select all
Type Chunk: source is not a container
Object card id 1002
Line put getX(graphic "Rectangle1") into field "Field1"
Hint moveRectDist
But I am passing an object, a graphic, to a function. And it worked as expected when using "the target." And I didn't give it a second thought. Until I tried to pass a graphic using different syntax.
I would like to know what is the proper way to pass objects such as graphics to a function? And can you recommend any resources that address this?
Muchas Gracias.