niconiko at gmail.com
Tue Dec 6 17:12:11 EST 2011
I have a script that does not always work as expected.
>From the student's point of the view, the script allows them to click
and drag an alphabet letter for release onto a writing area. That way,
there's two images visible : the image they clicked on originally
apparently at its original location, and the new image apparently now
in the new location.
The problem visually is that it seems like the original image becomes
draggable, and the cloned image gets left behind.
What the script is actually doing in the background is on mouseDown
the original image is cloned, the clone gets the original image's
name, and the original image gets a new name. Similarly, their
layering is switched too. That was the only way I could think of to
allow an image to become draggable and cloned at the same time, i.e.,
Also, instead of mouseDown, I'm using AnimationEngine's
The problem with my script is that sometimes the image that's supposed
to stay in place becomes the image that's supposed to be draggable. I
assume the problem happens in the renaming my script does.
Here is the actual script:
deleteClonedHilites -- deletes unneeded graphic objects
put the short name of me into tGrabbedImg
if "_" is not among the chars of tGrabbedImg then
## the char "_" is added by my script when renaming
clone invisible image tGrabbedImg
put word 3 of it into tNewImgID
put tGrabbedImg & "_" & the milliseconds into tNewImgName
set the name of me to tNewImgName
put the cpCloned_Letters of this card into tTemp
put tNewImgName & cr after tTemp
set the cpCloned_Letters of this card to tTemp
set the name of image id tNewImgID to tGrabbedImg
set the loc of image id tNewImgID to the loc of me
set the layer of image id tNewImgID to the layer of me
show image id tNewImgID
set the layer of me to top
put item 1 of the clickLoc into sX
put the milliseconds into sLastTime
put true into sMove
If anyone understands and can help, I'd much appreciate it.
More information about the Use-livecode