Create Image, Hide Image

Jeanne A. E. DeVoto jeanne at runrev.com
Sat Dec 7 18:40:40 EST 2002


At 3:09 PM -0800 12/7/02, JamesHBeckmann at aol.com wrote:
>Bear with this new user:
>
>I created a NEW stack, placed one fld "pictfld" and one button "Display" on
>it.  I put the following script into the button:
>
>on mouseUp
>  answer file empty
>  put it into thisPict
>  set the rect of templateimage to the rect of fld pictFld
>  set the filename of templateimage to thisPict
>  set the lockLoc of templateimage to true
>  create image "Holder"
>  wait 3 secs
>  hide image "Holder"
>  send "choose browse tool" to me in 1 tick
>end mouseUp
>
>So the script works on the first run, showing the image and hiding the image.
> Press the button again and the next image does not "hide".
>
>So I opened the Properties of the button, and then noted on the Editing
>scrolling button that there is an object "Image Holder" that is never killed.
>
>I was under the impression that this use of "create" did not permanently
>store an object.
>
>What can I change?

"Create" just creates the new object, so it is stored in the stack (and is
saved the next time you save the stack). If you want to get rid of it, just
use the delete command:

  delete image "Holder"

Or in this case, you can just keep the image "Holder" around permanently,
and instead of issuing a new "create" command, simply change "Holder"'s
properties to suit:

  on mouseUp
     answer file empty
     put it into thisPict
     set the rect of image "Holder" to the rect of field pictFld
     set the filename of image "Holder" to thisPict
     show image "Holder"
     wait 3 seconds
     hide image "Holder"
  end mouseUp

--
Jeanne A. E. DeVoto ~ jeanne at runrev.com
Runtime Revolution Limited - The Solution for Software Development
http://www.runrev.com/





More information about the use-livecode mailing list