Copy Image

Sarah Reichelt sarah.reichelt at gmail.com
Fri Oct 7 01:47:22 EDT 2005


> I am trying to copy and image from the current card to a card in a external
> stack, "GrommetData".
>
> If the image is already there from a previous copy,  I delete it first and
> then copy it to the card.
>
> If the image is already there all works as expected, BUT if the image is not
> alredy there I get an error after the image is copied.  The handler looks
> like this
>
>
>    IF exists (img "image" of cd tCard of stack "GrommetData") THEN
>       delete img "image" of cd tCard of stack "GrommetData"
>    END if
>
>    copy img "image" to cd tCard of stack "GrommetData"
>

Hi Todd,

I just made a test with a mainStack and a sub-stack called "Sub". I
imported an image from the image library and tested it with the
following button script:

on mouseUp
  if there is an img "alerthand.gif" of cd 1 of stack "Sub" then
    delete img "alerthand.gif" of cd 1 of stack "Sub"
    wait 1 second
  end if
  copy img "alerthand.gif" to cd 1 of stack "Sub"
  put the result
end mouseUp

It all worked perfectly whether Sub had the image already or not. (The
wait is only there so that I can see that the original is really
deleted).

You say the error occurs after the image has been copied. What is the
error? What happens next in your script? If you isolate the copying
script completely, does it work then?

Cheers,
Sarah



More information about the use-livecode mailing list