Copying referenced images issue...

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
PaulMaguire
Posts: 44
Joined: Wed Feb 13, 2013 3:38 pm
Contact:

Copying referenced images issue...

Post by PaulMaguire » Wed Mar 13, 2013 7:26 pm

Hi.

More simple lamer stuff I don't quite understand in Livecode!
This only fails when my image assets are referenced rather than embedded.
I don't want to embed all the assets (they are changing throughout development and I am replacing them). This is ultimately for a mobile app (I have the assets folder in the 'CopyFiles' file path).
Here's how I am getting the image:

Code: Select all

   put image tImageName of cd "Assets01" of stack "AssetsStack" into image "prepImage" of this card
(tImageName is a string eg. "thisImage.jpg"). I am actually taking this prepImage and putting it into a scrollable field - it appears (ie. it has dimensions) but is blank. Am I missing something here (um, clearly)? Any pointers appreciated.

Kind regards, Paul.

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

Re: Copying referenced images issue...

Post by Klaus » Thu Mar 14, 2013 9:58 am

Hi Paul,

you need to "copy" the FILENAME, since "img whatever" is "empty" in this case!

Code: Select all

...
set the filename of img "prepImage" of this card to the filename of image tImageName of cd "Assets01" of stack "AssetsStack"
...
Or if you are not sure if the image is referenced or imported:

Code: Select all

...
if the filename of image tImageName of cd "Assets01" of stack "AssetsStack" = EMPTY then
   ## imported -> copy the image itself
   put image tImageName of cd "Assets01" of stack "AssetsStack" into image "prepImage" of this card
else
  ## only "copy" the filename
  set the filename of img "prepImage" of this card to the filename of image tImageName of cd "Assets01" of stack "AssetsStack"
end if
...
Best

Klaus

PaulMaguire
Posts: 44
Joined: Wed Feb 13, 2013 3:38 pm
Contact:

Re: Copying referenced images issue...

Post by PaulMaguire » Thu Mar 14, 2013 11:07 am

THANK YOU KLAUS!

Post Reply