Image to graphic

Jim Hurley jhurley at infostations.com
Thu Nov 20 09:23:30 EST 2003


>
>Message: 4
>Date: Wed, 19 Nov 2003 19:49:04 -0600
>From: Bojsza <gbojsza at mac.com>
>Subject: Image to graphic
>To: use-revolution at lists.runrev.com
>Message-ID: <B86655CE-1AFB-11D8-959E-003065F00EF2 at mac.com>
>Content-Type: text/plain; charset=US-ASCII; format=flowed
>
>I have two nodes (filled rectangles) and I want to be able to have a
>script connect them with a line graphic.
>
>...
>choose line tool
>drag from loc of grc node1 to loc of grc node2
>...
>this does create a line but it is an image and I need a graphic because
>I want to be able to allow the user to move the nodes and keep the line
>"attached".
>
>This is also the second question I have... how can I create the effect
>of a "sticky" line?
>
>thanks,
>
>Glen
>


Glen,

You might try something like this. Put the following into the scripts 
of each of the graphic squares:

local myName

on mousedown
   put the name of me into myName
end mousedown

on mouseUp
   put "" into myName
end mouseUp

on mouseRelease
   put "" into myName
end mouseRelease

on mouseMove x,y
   if myName is  "" then exit mouseMove
   set the loc of me to x,y
   put the points of grc "theLine" into tPoints
   put x,y into line 1 of tPoints --Where 1 is for this square; use 2 
for the other
   set the points of grc "theLine" to tPoints
end mouseMove

Where the line graphic is named "theLine"

Jim


More information about the use-livecode mailing list