Image not showing in emulator

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
WarrenW
Posts: 27
Joined: Tue Oct 02, 2012 4:26 pm

Image not showing in emulator

Post by WarrenW » Fri Oct 05, 2012 8:11 pm

Hi,

I added an image area in my app and loaded a picture through the properties. When i ran it in the Android 2.3 emulator there was no image. Does the image file itself need to be in a certain folder to be included? I must have missed something.

Thanks,

Warren

Mark
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 5150
Joined: Thu Feb 23, 2006 9:24 pm
Contact:

Re: Image not showing in emulator

Post by Mark » Sat Oct 06, 2012 12:34 am

Hi,

The most secure way is to import a picture using File/Import As Control/Image File... You could also include the image in the standalone package (see the Files tab in the standalone application settings window) and use relative file paths in the properties inspector.

Kind regards,

Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode

WarrenW
Posts: 27
Joined: Tue Oct 02, 2012 4:26 pm

Re: Image not showing in emulator

Post by WarrenW » Sat Oct 06, 2012 12:43 am

Thanks. Ill have to go in the LiveCode program and wheee all of that is.

Warren

WarrenW
Posts: 27
Joined: Tue Oct 02, 2012 4:26 pm

Re: Image not showing in emulator

Post by WarrenW » Tue Oct 09, 2012 8:07 pm

So if I use the Source property in the property inspector this will not work? I selected the image with the file selection and it shows in design mode. Then in the emulator it does not. If this is not the way to do it, then why do they let me select and show the image this way?

Thanks,

Warren

Klaus
Posts: 14177
Joined: Sat Apr 08, 2006 8:41 am
Contact:

Re: Image not showing in emulator

Post by Klaus » Tue Oct 09, 2012 8:53 pm

WarrenW wrote:...then why do they let me select and show the image this way?
THEY just want to annoy us! 8)

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: Image not showing in emulator

Post by jacque » Wed Oct 10, 2012 7:17 pm

WarrenW wrote:So if I use the Source property in the property inspector this will not work? I selected the image with the file selection and it shows in design mode. Then in the emulator it does not. If this is not the way to do it, then why do they let me select and show the image this way?
It works, but the path you chose is on your hard drive somewhere. When you run the app in the emulator, a new app folder is created that contains its own subfolders, including those you assigned in the Copy Files pane. Only those folders and resources are available to your mobile app, and the original path is now out of bounds.

To accomodate this, assign only relative paths to the images. Keep the images in a subfolder of the one that contains your stack. The source for the image should not be a full file path, but a relative one like "Images/photo.jpg". When you create or simulate the mobile app, be sure to include the Images folder in the Copy Files pane. That will put it where the mobile app can find it, an Images folder will be created inside the emulator app folder, and the relative path will still work.

In the IDE, the relative folder will not be found unless you set the defaultfolder to the one containing your stack. Somewhere in your stack scripts you should do that to ensure the Images folder is recognized.

As Mark suggested, an easier way to handle all this is to just import the image itself into the stack.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Post Reply