Getting into LiveCode for iOS? Ask your questions here.
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
Jellicle
- Posts: 453
- Joined: Thu Feb 24, 2011 11:07 am
Post
by Jellicle » Wed Jul 06, 2011 1:19 am
This works for me:
Code: Select all
on mouseup
iPhonePickPhoto "rear camera", 300,400 -- use the camera to take a pic
if the result = "cancel" then
exit mouseup
end if
-- the new photo will be the last image created, so will be numbered "image x"
-- where x is the total number of images on the card
iphoneExportImageToAlbum image (the number of images)
delete image (the number of images) -- unless you need to keep the image in the app for some reason, delete it
end mouseup
14" MacBook Pro
Former LiveCode developer.
Now recovering.
-
sylvanr
- Posts: 80
- Joined: Wed Nov 24, 2010 10:38 am
Post
by sylvanr » Wed Jul 06, 2011 8:30 am
Jellicle wrote:This works for me:
Code: Select all
on mouseup
iPhonePickPhoto "rear camera", 300,400 -- use the camera to take a pic
if the result = "cancel" then
exit mouseup
end if
-- the new photo will be the last image created, so will be numbered "image x"
-- where x is the total number of images on the card
iphoneExportImageToAlbum image (the number of images)
delete image (the number of images) -- unless you need to keep the image in the app for some reason, delete it
end mouseup
Hm. This IS the first time that I have seen a pic after taking it, BUT it is on my card where I have the button to take the picture rather than on the "roll." On the one hand, I am glad to see that a photo was actually captured by the button, but on the other hand, it is not in the place where it needs to be for the card and stack to continue to be functional for my purposes. The user needs to be able to take a pic and the pic needs to be sent to the roll automatically. Then if the user wants to use the button to take another pic, that pic should be sent to the roll. With this script, the pic is on the card itself, obscuring my button and the pic is lost when I close the stack. I thought that saving the pic to the roll was what the iphoneExportImageToAlbum part of the script was supposed to do? You say that this works for you? Does it save the pic to the roll or to the card? I'm perplexed.

-
Jellicle
- Posts: 453
- Joined: Thu Feb 24, 2011 11:07 am
Post
by Jellicle » Wed Jul 06, 2011 9:13 am
sylvanr wrote: Hm. This IS the first time that I have seen a pic after taking it, BUT it is on my card where I have the button to take the picture rather than on the "roll." On the one hand, I am glad to see that a photo was actually captured by the button, but on the other hand, it is not in the place where it needs to be for the card and stack to continue to be functional for my purposes. The user needs to be able to take a pic and the pic needs to be sent to the roll automatically.
That's what my script does - have you checked your camera roll?
It works perfectly on my device. Sure, you'll see the captured photo for a few seconds as it is saved to the roll, but my script deletes it once it is saved. I could have moved the image off screen to avoid that, but in this simple example I didn't bother.
14" MacBook Pro
Former LiveCode developer.
Now recovering.
-
Klaus
- Posts: 14177
- Joined: Sat Apr 08, 2006 8:41 am
-
Contact:
Post
by Klaus » Wed Jul 06, 2011 11:05 am
You could surely add a "lock screen" right after "on mouseup" so the user will not see anything.
Not tested, but should work! (Famous last words

)
-
sylvanr
- Posts: 80
- Joined: Wed Nov 24, 2010 10:38 am
Post
by sylvanr » Thu Jul 07, 2011 9:48 am
Well, I think I found my problem. I finally remembered that email I had got about a week or so ago about an updated version of Livecode (4.6.2). I had still been using 4.6. I wondered to myself, could that little .2 really make a difference? So I downloaded it and then found that I also needed to update the Apple SDK to use it. So I did that as well. I had just gotten busy or sidetracked or something and hadn't been focused on these things for a month or so. After I updated everything, voila!, the picture was taken and after a few seconds, DID disappear off my card, and when I checked the roll, there it was!!
Thanks all for your help. I still wouldn't have figured it out without your suggestions and code even if I had kept everything updated as one should!! Thank you, thank you, thank you.