Images in Livecode

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

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

Re: Images in Livecode

Post by Klaus » Tue Aug 01, 2017 8:36 am

Hi David,

this will work in the IDE and in a standalone, if you added the folder "images" via the "Copy fikles" tab in the standalone builder settings:

Code: Select all

on mouseup
   ## Reference image:
   set the filename of img 1 to (specialfolderpath("resources") & "/images/crow.jpg")

   ## Or directly import the image, was not sure what you were after:
   put url("binfile:" & specialfolderpath("resources") & "/images/crow.jpg") into img 1
end mouseup
In the IDE specialfolderpath("resources") points to the folder the current stack is in.

Best

Klaus

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Images in Livecode

Post by bidgeeman » Tue Aug 01, 2017 8:41 am

Hi Klaus,
Thanks. So basically it won't load from a folder while in Livecode but will load when it is compiled is that correct?

Regards
Bidge

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Images in Livecode

Post by AndyP » Tue Aug 01, 2017 9:24 am

Attached is your script modified with my example.
Attachments
LoadImage.zip
(10.27 KiB) Downloaded 248 times
Last edited by AndyP on Tue Aug 01, 2017 9:29 am, edited 1 time in total.
Andy .... LC CLASSIC ROCKS!

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

Re: Images in Livecode

Post by Klaus » Tue Aug 01, 2017 9:25 am

So what part of "... this will work in the IDE and in a standalone..." did you not understand? 8)

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Images in Livecode

Post by bidgeeman » Tue Aug 01, 2017 9:55 am

Oh thanks Andy. I wasn't following what you were suggesting but now I can see now how well the script works.
Klaus, yes I can see that your way is the easiest way to do it with my basic understanding and I appreciate the advice :)
It's a bit hard to work blind that way though.

Thanks again
Bidge

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Images in Livecode

Post by bidgeeman » Wed Aug 02, 2017 7:52 am

Hi.
I have another question please.
Is it possible to have an answer dialogue appear with a different color background?
I have set a dark color to one of my cards and it seems to be locked into the answer dialogue box as the default background color.

Code: Select all

answer info "This will erase your current image. Continue?" with "Yes" or "No" 
Thanks again
Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Images in Livecode

Post by richmond62 » Wed Aug 02, 2017 8:34 am

PMAD.png
PMAD.livecode.zip
Here's the stack
(23.66 KiB) Downloaded 251 times

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Images in Livecode

Post by bidgeeman » Wed Aug 02, 2017 8:58 am

Hi richmond62.
That is amazing! :shock: These are the sorts of tips that are really hard to find.

Thank you so much.
Bidge

richmond62
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 10099
Joined: Fri Feb 19, 2010 10:17 am

Re: Images in Livecode

Post by richmond62 » Wed Aug 02, 2017 10:50 am

These are the sorts of tips that are really hard to find.
I didn't "find" that: I just did a bit of thinking AND
looked in the stack list, and found "Answer Dialog" . . . . boom, boom :D
Boom Boom.jpg
https://en.wikipedia.org/wiki/Basil_Brush

bidgeeman
Posts: 495
Joined: Wed Feb 21, 2007 7:58 am

Re: Images in Livecode

Post by bidgeeman » Wed Aug 02, 2017 10:56 am

:lol:
EDIT: Oh...stack list?

EDIT: Ahhh...I just found it in the dictionary under "Answer Color"
Bidge

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

Re: Images in Livecode

Post by Klaus » Wed Aug 02, 2017 11:46 am

Hi David,

remember that LC is made with LC, so everything in the IDE is a stack resp. scripted and can be modified!


Best

Klaus

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

Re: Images in Livecode

Post by Klaus » Wed Aug 02, 2017 12:52 pm

Klaus wrote:...remember that LC is made with LC, so everything in the IDE is a stack resp. scripted and can be modified!
IMPORTANT ADDENDUM: Except the engine and its functionality, which is made with C++ 8)

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Images in Livecode

Post by bogs » Wed Aug 02, 2017 4:49 pm

Klaus wrote:Hi David,
remember that LC is made with LC, so everything in the IDE is a stack resp. scripted and can be modified!
Best
Klaus
Also remember that the worst thing that can possibly happen if you edit the ide is that you might have to reinstall it :mrgreen: so don't be afraid to poke around, it can't possibly bring about the end of the universe :!:

*Edit - disclaimer: this doesn't mean that a possibly worse situation could arise, like modifying code and having it appear to work but introducing a logic flaw that slowly degrades reliability over time, for example.
...don't drink milk if your lactose intolerant
...look both ways before crossing the street
...etc
Image

SparkOut
Posts: 2947
Joined: Sun Sep 23, 2007 4:58 pm

Re: Images in Livecode

Post by SparkOut » Fri Aug 04, 2017 10:09 pm

16 times I've endured the end of the universe. Never a single occasion that LiveCode IDE has been the cause.

bogs
Posts: 5480
Joined: Sat Feb 25, 2017 10:45 pm

Re: Images in Livecode

Post by bogs » Sat Aug 05, 2017 5:28 am

See? Even an expert agrees !

[Note to self : start working out code needed to end universe... :twisted: ]
Image

Post Reply