gpt4 book ai didi

android - 将 Camera 类与 Flex Mobile Framework 和 Android 一起使用

转载 作者:行者123 更新时间:2023-11-29 16:09:46 25 4
gpt4 key购买 nike

我喜欢许多其他人尝试使用 zxing ActionScript 库为我的 Flex Mobile 应用程序实现条形码扫描仪。我的问题是我很难让相机在实际设备上正确显示。在带有网络摄像头的桌面上运行该应用程序可以很好地显示视频源。以下是我在 Galaxy Nexus 和 Nexus 7 上获得的类似信息。

on the galaxy nexus

我一直主要研究这个例子,但也采纳了其他网站的建议: http://www.remotesynthesis.com/post.cfm/adding-a-qr-code-reader-in-flex-on-android

所有内容都会为视频对象生成相同的古怪提要。有人知道我能做些什么来纠正这个问题吗?

这是我当前形式的代码,此时它只是试图获得清晰的图片(还没有条形码垃圾):

扫描仪2.mxml

<?xml version="1.0" encoding="utf-8"?>
<s:View xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:bs="com.expologic.barcodescanner"
title="Scanner" creationComplete="init(event)">
<fx:Declarations>
<!-- Place non-visual elements (e.g., services, value objects) here -->
</fx:Declarations>

<fx:Script>
<![CDATA[
import mx.core.UIComponent;

import com.expologic.barcodescanner.BarcodeScanner;

private var bs:BarcodeScanner;

private function init(e:Event):void {

bs = new BarcodeScanner();
bs.horizontalCenter = 0;
bs.verticalCenter = 0;
bs.height = 480;
bs.width = 640;

addElement(bs);

//To add a target to the center of the screen
var uic:UIComponent = new UIComponent();
this.addElement(uic);

uic.width = uic.height = 275;
uic.graphics.lineStyle(3,0xFF0000);
uic.graphics.drawRect(0,0,275,275);

uic.horizontalCenter = uic.verticalCenter = 0;

}


]]>
</fx:Script>



</s:View>

条码扫描器.as

package com.expologic.barcodescanner
{

import flash.events.Event;
import flash.media.Camera;
import flash.media.Video;

import spark.core.SpriteVisualElement;

public class BarcodeScanner extends SpriteVisualElement
{

private var _video:Video;

public function BarcodeScanner()
{

this.height = 480;
this.width = 640;

addEventListener(Event.ADDED_TO_STAGE, _addToStage);

}

private function _addToStage(e:Event):void {
_setupCamera();
}


private function _setupCamera():void
{

if(!_video)
{
_video = new Video(640, 480);
addChild(_video);
}

if(Camera.isSupported)
{
var cam:Camera = Camera.getCamera();
cam.setQuality(0, 100);
cam.setMode(640, 480, 30, false);

_video.attachCamera(cam);
}
}

}
}

最佳答案

尝试设置<renderMode>direct</renderMode>在你的 app.xml 中,这为我解决了问题,我也在使用 Galaxy Nexus。问候乔科

关于android - 将 Camera 类与 Flex Mobile Framework 和 Android 一起使用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14416973/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com