Keep having this error message :
Line: 2050
Attempt to index local ‘photo’ (a nil value)
Here is my code (part of it) :
function btnmyBtn(self) --External code local onComplete = function(event) -- Create local variable named photo local photo = event.target photo:setReferencePoint(display.TopLeftReferencePoint); -- Place photo over the body photo.x = 0; photo.y = 0; -- Scale down the photo to match the body scale -- Note that 0.07 scale is ideal for iPad 3rd Generation camera -- Other cameras may need different scaling photo.xScale = display.contentScaleX photo.yScale = display.contentScaleY -- Remove the lyrhead image placeholder from the group named "guy" guy:remove(lyrhead); -- Insert the newly taken picture in place of the lyrhead guy:insert(photo); end -- If a camera exists on the device, start camera function if media.hasSource( media.Camera ) then media.show( media.Camera, onComplete ) else -- If camera doens't exist, show alert popup native.showAlert( "Corona", "This device does not have a camera.", { "OK" } ) end end
And here is the line 2050 :
photo:setReferencePoint(display.TopLeftReferencePoint);
Any advice will help.
Thank you
