2

I searched and tried many things to get this bug fixed. I have this following code for iOS.

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); 
    }

It's only saving the background, but the bitmap and the image isn't saved. Why?

OnaBai
  • 40,767
  • 6
  • 96
  • 125
Nicolas Sleiman
  • 124
  • 1
  • 8

1 Answers1

3

assuming ldr.content is your background image.
Your angles are wrong.
Rotating anything 90 degrees or 270 on any single axis will cause the image to not be visible.

The_asMan
  • 6,364
  • 4
  • 23
  • 34