Reuse an image

Paul Hibbert lc at pbh.on-rev.com
Thu Nov 15 18:28:02 EST 2012


Hi Peter,

If I understand you correctly, you would need to build a repeat loop to work through your images with something like…

     set the imageData of img "extRefImage" to the imageData of img "intImage"

Beware if your images are scaled, that will affect the imageData, they need to be the same size.

If the referenced images are identical to the internal images, you maybe didn't need to re-import them as controls, just…

     set the imageData of img "A" to the imageData of img "A"

this will convert a referenced image to an an internal image at the size it is displayed, but if they are scaled images, try…

  lock screen

  ## Record the size and position of the image
  put the width of img "imageX" into tWidth
  put the height of img "imageX" into tHeight
  put the loc of img "imageX" into tLoc

  ## Convert Ref image to Internal image
  set the width of img "imageX" to the formattedWidth of img "imageX"
  set the height of img "imageX" to the formattedHeight of img "imageX"
  set the imageData of img "imageX" to the imageData of img "imageX"

  ## Re-set the size and position of the image
  set the width of img "imageX" to tWidth
  set the height of img "imageX" to tHeight
  set the loc of img "imageX" to tLoc

  unlock screen

Hope this helps.

Paul


On 2012-11-15, at 12:27 PM, Peter Bogdanoff wrote:

> Hi,
> 
> Simple task: I want to reuse an image that was imported as a control into a substack.
> 
> I know I can copy and paste, but I want to now replace many externally referenced images with their internal equivalents that I just imported. In other words, substitute the external with internal while keeping the old locs, scripts, etc., in place.
> 
> Can this be done?
> 
> Thanks!
> 
> Peter Bogdanoff
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list