Display 'Import Snapshot' (SOLVED)

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Display 'Import Snapshot' (SOLVED)

Post by Traxgeek » Tue Oct 07, 2014 11:19 am

Hi,
I'm sure I've read something 'special' about this in a thread somewhere but... I can't find it now... :oops:

I have a script that takes a snapshot of a card and displays it on another card.
Simple enough and... the script works perfectly on my Mac / PC :

Code: Select all

      set the visible of the templateImage to false
      put the rect of card "crdSource" into sRect
      import snapshot from rect sRect of card "crdSource"
      put the long id of the last image into sImgID

      #set the text of image "imgBackground" of card "crdDestination" of stack "stkSubStack" to the text of sID --This one ?
      put the last image into image "imgBackground" of card "crdDestination" of stack "stkSubStack" --or this one ? (Both pass LC testing but neither display the image on Android)

      if sID begins with "Image id" then
         delete sID --Delete my temp image
      end if
The same code doesn't work for me on Android !!

I THINK I read that one may need to set the specialfolderpath or somesuch to get this to function with mobile but... like I say... I can't find the thread anymore and although I've tried various things ('specialfolderpath' and 'wait with messages' between grabbing and displaying the image) I still come up with nothing.

Anyone able to put me out of my misery please ?

Thanks a million.
Last edited by Traxgeek on Thu Oct 09, 2014 2:50 pm, edited 1 time in total.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

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

Re: Display 'Import Snapshot' (Android)

Post by Klaus » Tue Oct 07, 2014 11:56 am

Hi Traxgeek,

not sure what is going wrong, but two hints:
1. you can export a screenshot directly into another image, no need for temporary image objects.
Try this:
...
EXPORT snapshot from rect sRect of card "crdSource" to image "imgBackground" of card "crdDestination" of stack "stkSubStack"
...

2. There is no need to mess with any specialfolderpath here, we stay "inhouse" :D


Best

Klaus

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Display 'Import Snapshot' (Android)

Post by Traxgeek » Tue Oct 07, 2014 11:57 am

As ever - Thanks Klaus !

I'll go try it now and get back to you.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Traxgeek
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 281
Joined: Wed Jan 09, 2013 10:11 am

Re: Display 'Import Snapshot' (Android) (SOLVED)

Post by Traxgeek » Tue Oct 07, 2014 12:10 pm

Hmmmm....

I think a restriction of this code line ...

Code: Select all

EXPORT snapshot from rect sRect of card "crdSource" to image "imgBackground" of card "crdDestination" of stack "stkSubStack"
... is that the card in the Sub-Stack has to be open - because I get the following error when I try it :

export: no image selected, or image not open

I'm guessing the image is self-selected (provided 'crdSource' exists - which it does) therefore, my assumption is that, because my sub-Stack card is not yet open, I receive the 'image not open' error...

So, what I'm trying is to put the code line you gave into the card pre-open script... just need to code the card that the new card is to export its snapshot from... simple enough...

Thanks a million Klaus.
I'm 'getting there'... just far too slowly !
Mac (Siera) and PC (Win7)
LiveCode 8.1.2 / 7.1.1

Post Reply