我正在尝试在 flash pro 中使用 adobe air 调用 cameraUi 方法。我正在尝试loggedIn();
从文档类(main.as)调用该方法,但出现以下运行时错误:
Error #2044: Unhandled error:. text=unavailable
我试过注释掉不同的代码片段,但找不到问题区域。下面是我的 AccessCamera 类。
package Classes {
import flash.display.*;
import flash.media.*;
import flash.media.Camera;
import flash.media.CameraUI;
import flash.events.MediaEvent;
import flash.net.*;
public class AccessCamera extends MovieClip {
//-------------- CameraUI-----------------------//
public static var ui = new CameraUI();
public static var video = new Video();
//------------- end Camera UI------------------//
public function AccessCamera() {
// constructor code
trace ("access camera class accessed");
loggedIn();
}
public function loggedIn(){
//------------cmaera UI---------------//
ui.launch(MediaType.VIDEO);
ui.addEventListener(MediaEvent.COMPLETE,UICompleteHandler);
}
public function UICompleteHandler(event:MediaEvent):void{
var media:MediaPromise = event.data;
trace(media.file.url + " - " + media.relativePath + " - " +media.mediaType);
parent.addChild(video);
var conn:NetConnection = new NetConnection();
conn.connect(null);
//attach a stream to the video-object
var stream:NetStream = new NetStream(conn);
video.attachNetStream(stream);
stream.client = new MobileClient();
//play the stream
stream.play(media.file.url);
}
}
}
class MobileClient {
public function onMetaData(info:Object):void {
trace("metadata: duration=" + info.duration + " width=" + info.width + " height=" + info.height + " framerate=" + info.framerate);
}
public function onCuePoint(info:Object):void {
trace("cuepoint: time=" + info.time + " name=" + info.name + " type=" + info.type);
}
}