LiveCode LessonsHow To - Step-By-Step Guides To Tasks In LiveCode Using ImagesHow do you embed an image in a stack so a path reference is not needed?

How do you embed an image in a stack so a path reference is not needed?

This lesson will show you how to directly embed an image into a stack so that the original image file is no longer needed

Import Image File as a Control

Import Image File as a Control

Open your stack and display the card you wish to import the image into. To import the image file, first select "File" for the menu, then "Import as Control", then select  "Image File..." on the submenu (File>>Import as Control>>Image File..). You can also use the shortcut "Ctrl + >". A control is any object that can be placed on a card such as a button, field or image. These objects are stored as part of the stack and are incorporated into the standalone application file.

Select the Image Filepath

Select the Image Filepath

Select the image you require using the file dialog. If your image file does not appear in its folder then it may be the case that it has an incorrect file extension.

Adjust the Image Position and Size

Adjust the Image Position and Size

You can now use the selection handles around the image to move and resize the image. You can also right click on the image and change its properties that way.

Once the stack is saved this image will become part of the stack. The image will stay in the stack  even if the original image file can be moved or deleted.

3 Comments

Christer

How do you drag an image to a stack image?

Ben Beaumont

Hi Christer, take a look at acceptDrop property as well of DragData.. specifically dragData["files"] will tell you if a file have been grabbed and released over your stack. Assuming of course your set the acceptDrop to true. We'll put a lesson out on this in the next week or so. Thanks for your question.

Elanor Buchanan

Hi Christer, acceptDrop was actually deprecated in Rev 2.9, take a look at the dragAction property instead.

There is now a lesson on how to do this at

http://lessons.runrev.com/spaces/lessons/buckets/784/lessons/17203-How-do-you-display-an-image-by-dragging-it-on-to-a-stack-

I hope that helps you.

Add your comment

E-Mail me when someone replies to this comment