2
我搜索並嘗試了很多事情來修復這個bug。我有以下iOS代碼。使用bitmapdata.draw()的錯誤AS3
import flash.media.CameraRoll;
//import flash.events.MediaEvent;
import flash.events.Event;
import flash.events.ErrorEvent;
stop();
var IMAGE_URL:String = new String(backgroundd);
var ldr:Loader = new Loader();
var bitmap1:Bitmap;
var bitmap2:Bitmap;
var bitmap3:Bitmap;
var bitmap4:Bitmap;
var bitmap5:Bitmap;
var image = new images();
ldr.contentLoaderInfo.addEventListener(Event.COMPLETE, addSides);
ldr.load(new URLRequest(IMAGE_URL));
function addSides(evt:Event):void {
var bmp:Bitmap = ldr.content as Bitmap;
bitmap1 = new Bitmap(bmp.bitmapData);
bitmap1.rotationX = 90;
addChild(bitmap1);
bitmap2 = new Bitmap(bmp.bitmapData);
bitmap2.z = 400;
bitmap2.rotationY = 90;
addChild(bitmap2);
bitmap3 = new Bitmap(bmp.bitmapData);
bitmap3.z = 400 ;
addChild(bitmap3);
bitmap5 = new Bitmap(bmp.bitmapData);
bitmap5.y = 400;
bitmap5.z = 400;
bitmap5.rotationX = 270;
addChild(bitmap5);
middle()
}
function middle(): void {
image.width = 230;
image.height = 175;
image.x = 209;
image.y = 227;
addChild(image);
}
if (CameraRoll.supportsAddBitmapData)
{
var cameraRoll:CameraRoll = new CameraRoll();
cameraRoll.addEventListener(ErrorEvent.ERROR, onCrError);
cameraRoll.addEventListener(Event.COMPLETE, onCrComplete);
drawit()
}
else
{
trace("not supported.");
}
function onCrError(event:ErrorEvent):void
{
}
function onCrComplete(event:Event):void
{
gotoAndStop(1,null);
}
function drawit(){
var bitmapData:BitmapData = new BitmapData(stage.stageWidth, stage.stageHeight);
bitmapData.draw(stage);
cameraRoll.addBitmapData(bitmapData);
}
它的唯一可取的背景,但該位圖,圖像不會被保存。爲什麼?
因爲旋轉軸是左上角? – Jono
thx,你有什麼想法我怎麼能得到相同的效果? –
@ The_asMan - 不錯的地方。 – 2013-01-09 22:53:11