app crashing after attaching camera (air for android 16.0)

153 Views Asked by At
var u:uint = 1
var cam2 = Camera.getCamera(String(1))
    cam2.setMode(480,500, 25)
    cam2.setQuality(0,100)

vid2.attachCamera(cam2)
vid2.rotation = -90
vid2.y = 480
vid2.x = 0

swtch.addEventListener(MouseEvent.CLICK, pal)
function pal(event:MouseEvent)
{

    if(u == 1) {

        u = 0
        cam2 = Camera.getCamera(String(u))
        vid2.attachCamera(cam2);
        vid2.rotation = 90
        vid2.x = 500
        vid2.y = 0

    } 
    else if ( u == 0 ) {

        u = 1
        cam2 = Camera.getCamera(String(u))
        vid2.attachCamera(cam2)
        vid2.rotation = -90
        vid2.y = 480
        vid2.x = 0

    }

    trace('vidx' + vid2.x + 'vidy' + vid2.y)    

}

Above code switch camera between front and back on clicking button. when i use air 3.4 bundled in apk file above code work perfectly on my mobile (os android 4.2) when i bundle air 16.0 in apk file ,front cam is streams in video but app crashes on clicking button to switch between front and back cam

1

There are 1 best solutions below

0
shefali On

in app.xml...

change to

<renderMode>direct</renderMode>

I have found that when use render mode "auto" or "cpu", this issue happen. But when use "direct", it's OK.