trying to get image functionality as in RB

Jim Ault JimAultWins at yahoo.com
Fri Apr 6 22:57:41 EDT 2007


> On 4/6/07, Ken Ray <kray at sonsothunder.com> wrote:
On 4/6/07 3:57 PM, "wayne durden" <wdurden at gmail.com> wrote:

> Thank you Ken!  I will give that a go shortly.  It looks like it will
> shorten the existing method I was using that was handling the local files as
> well.
> 
>> 
>> Sure... here's a way, assuming you already have an image object on the
>> card and you're dropping onto it (this is the script of the image
>> object):
>> 
>> on dragEnter
>>   set the acceptDrop to true
>>   pass dragEnter
>> end dragEnter
>> 
>> on dragDrop
>>   if the dragData["image"] is not empty then
>>     put the dragData["image"] into me
>>   else
>>     beep
>>   end if
>> end dragDrop
>> 
>> For more info on D-n-D, see this tip:
>> 
>>     http://www.sonsothunder.com/devres/revolution/tips/mous002.htm

The dragDrop also works from things like iPhoto and several catalog
programs, such as iView Media Pro.

One technique I use is to make an image, put a transparent button over it,
group them, and this becomes a 'landing point' for my drop.  Then the
following steps...

--for the transparent button
--note: this is not the exact code, but a shorter summarized version

set the cpOrigImg => the imagedata of the dropped img
set the cpOrigWidth of btn "transp" the width of the dropped img
set the cpOrigHeight of btn "transp" the height of the dropped img
create img
set the imagedata of the last img to the cpOrigImg of btn "transp"
set the height of the last img to thumbHeight
set the width of the last img to thumbWidth
set the imagedata of img "underTranspBtn" to the imageData of the last img
set the height of the last img to cpOrigHeight of btn "transp"
set the width of the last img to cpOrigWidth of btn "transp"
set the imagedata of the last image to the cpOrigImg of btn "transp"
save this stack --
--now you can adjust the last img all you want, then UNDO changes simply by

set the height of the last img to cpOrigHeight of btn "transp"
set the width of the last img to cpOrigWidth of btn "transp"
set the imagedata of the last image to the cpOrigImg of btn "transp"

This may not be useful in your case.  It is a way of allowing the original
drag to be 'cached', since gathering images from various sources could mean
you have to remember where you got them, and set up to do the drag again.
This makes it more convenient to simply have a button "reset last img".

Jim Ault
Las Vegas





More information about the use-livecode mailing list