В Livecode, как вы загружаете изображения, которые находятся на устройстве, на котором работает приложение?

Если бы приложение было на iPad, как бы вы получили изображения, которые находятся на этом iPad?

1 ответ

Следующее из моего проекта. Это должно работать просто так.

function rescale theImgWidth,theImgHeight,theCdWidth,theCdHeight
  if theCdWidth/theImgWidth < theCdHeight/theImgHeight then
    put theCdWidth / theImgWidth into myRatio
  else
    put theCdHeight / theImgHeight into myRatio
  end if
  put theImgWidth * myRatio into myNewWidth
  put theImgHeight * myRatio into myNewHeight
  return myNewWidth,myNewHeight
end rescale

on pickPhoto
     set the visible of the templateImage to false
     if the environment is "mobile" then
          mobilePickPhoto "library"
          put the result into rslt
          if rslt is "Cancel" then 
               exit pickPhoto
          else
               if there is an image "Photo" then
                    delete image "Photo"
               end if
               put the long id of the last img into myImage
               set the name of myImage to "Photo"
          end if
     else
          answer file "Choose a picture..." with type "GIF|gif|GIFf" or type "JPEG|jpg,jpeg|JPEG" or type "PNG|png|PNGf" or type "All files|*|*"
          put the result into rslt
          if the result is "Cancel" or it is empty then 
               exit pickPhoto
          else
               put it into myFile
               if there is an image "Photo" then
                    delete image "Photo"
               end if
               create image "Photo"
               set the filename of it to myFile
               put it into myImage
          end if
     end if
     if there is a myImage then
          put rescale(the formattedWidth of myImage,the formattedHeight of myImage,the width of this cd,the height of this cd) into myWH
          set the width of myImage to item 1 of myWH
          set the height of myImage to item 2 of myWH
          set the loc of myImage to the loc of this cd
          show myImage
     end if
end pickPhoto
Другие вопросы по тегам