我有一些看起来应该有效的ActionScript代码,但是点击“capture_btn”按钮后出现此错误。
错误#2044:未处理的ErrorEvent: text =错误#2037:以错误顺序调用的函数,或之前的调用未成功。 at movember_1_fla :: MainTimeline / frame1()[movember_1_fla.MainTimeline :: frame1:8] 在运行时:: ContentPlayer / loadInitialContent() 在运行时:: ContentPlayer / playRawContent() 在运行时:: ContentPlayer / playContent() 在运行时:: AppRunner / run() 在ADLAppEntry / run() at global / runtime :: ADLEntry()**
以下是我的ActionScript:
import flash.events.MouseEvent;
import flash.media.CameraRoll;
import flash.display.Bitmap;
import flash.display.BitmapData;
banner_mc.visible=false;
var mediaSource:CameraRoll = new CameraRoll();
var cam:Camera = Camera.getCamera("0");
cam.setMode(tabletCam.width, tabletCam.height, 15, true);
tabletCam.attachCamera(cam);
capture_btn.addEventListenerTouchEvent.TOUCH_TAP,captureImage);
function captureImage(e:TouchEvent){
capture_btn.visible=false;
banner_mc.visible=true;
var screenCapture:BitmapData = new BitmapData(tabletCam.width,tabletCam.height);
screenCapture.draw(stage);
mediaSource.addBitmapData(screenCapture);
mediaSource.addEventListener(Event.COMPLETE, onSave);
}
function onSave(e:Event) {
capture_btn.visible=true;
banner_mc.visible=false;
}