Using the camera questions

I have two questions that have bothering me for a while.

I use the following code which was supplied by Ansca with cameras.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
local bkgd = display.newRect( 0, 0, display.stageWidth, display.stageHeight )
bkgd:setFillColor( 128, 0, 0 )
 
local text = display.newText( "Tap anywhere to launch Camera", 0, 0, nil, 16 )
text:setTextColor( 255, 255, 255 )
text.x = 0.5 * display.stageWidth
text.y = 0.5 * display.stageHeight
 
local sessionComplete = function(event)
        local t = event.target
 
        print( "Camera ", ( not t and "returned an image" ) or "session was cancelled" )
        print( "event name: " .. event.name )
        print( "target: " .. tostring( t ) )
 
        if t then
                local w = t.width
                local h = t.height
                print( "w,h = ".. w .."," .. h )
        end
end
 
local listener = function( event )
        media.show( media.Camera, sessionComplete )
        return true
end
bkgd:addEventListener( "tap", listener )

I finally got the first question after sometime... it was much easier than i thought...

1
2
t.x = 200
t.y = 200
views:2699 update:2012/2/13 9:11:28
corona forums © 2003-2011