Page 1 of 1
Camera question
Posted: Wed Jun 22, 2011 1:06 am
by doobox
Hi there,
Using this sample:
Code: Select all
on mouseUp
mobilePickPhoto "library", 212, 122
if the result is text then
put the result into image "The_Image"
else
put the result into field "The_Result"
end if
end mouseUp
The image is returned to the card, dead center. Not in the container.
It seems the result only contains errors if any. Is that correct..?
Once the image is placed on the card then. How do i capture it into a variable..?
I believe it is placed in a templateimage object, but how can i get at it..?
PS: this in in the simulator.. does it make a difference..?
Re: Camera question
Posted: Wed Jun 22, 2011 1:25 am
by doobox
I think i worked it out. Is this the recognized way to name the newly created image object..?
Code: Select all
on mouseUp
set the name of the templateimage to "harry"
mobilePickPhoto "library", 212, 122
end mouseUp
Re: Camera question
Posted: Wed Jun 22, 2011 12:28 pm
by Klaus
Hi doobox,
yes, this is correct behaviour!
When an operation is successful, "the result" will be empty, otherwise it will contain the error.
And this is the case with "mobilePickPhoto..."
So you should script something like this:
Code: Select all
on mouseUp
## This is the only way to name an imge BEFORE it is created
set the name of the templateimage to "harry"
mobilePickPhoto "library", 212, 122
if the result <> empty then
put the result into field "The_Result"
EXIT mouseup
end if
## Succes, now you can use the new image
...
end mouseUp
You can directly put an image into another image if necessary, no need to use a variable!
...
put last img into img "harry"
## This is valid syntax!
...
OR even:
...
set the text of img "harry" to the text of last img
...
Best
Klaus
Re: Camera question
Posted: Thu Jun 23, 2011 8:38 am
by doobox
Thank you Klaus,
I had got to :
Code: Select all
on mouseUp
set the name of the templateimage to "myimage"
mobilePickPhoto "library", 250, 250
if the result is not empty then
if the result is not "cancel" then
answer "Sorry you device does not have a camera"
else
return end mouseUp
end if
else
put image "myimage" into currentImage
delete image "myimage"
put currentImage into image "pic_holder"
put currentImage into thebaseimage
end if
end mouseUp
But i love this way:
thanks again..!
Re: Camera question
Posted: Thu Jun 23, 2011 11:06 am
by Klaus
Hi doobox,
oh, you have a very erm... special syntax here

:
Code: Select all
on mouseUp
set the name of the templateimage to "myimage"
mobilePickPhoto "library", 250, 250
if the result is not empty then
if the result is not "cancel" then
answer "Sorry you device does not have a camera"
else
## Wrong, and will surely fail when you least exspect it!
## return end mouseUp
## This is correct to leave a handler:
EXIT mouseup
...
Best
Klaus