LiveCode LessonsLiveCode LessonsHow To - Step-By-Step Guides To Tasks In LiveCodeUsing 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.



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

I hope that helps you.


the import as control.. importing image... the images will go back to their original sizes which are different from the intended sizes each time we reopen the livecode file

Elanor Buchanan

Hi Snarf, if you want to prevent an image resizing to its original size you can set its locLocation property to true, this will prevent it resizing.

You can find this property in the Position pane of the Property Inspector.

I hope that helps.


Add your comment

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.