Disable automatic image rotation in Flash Builder

59 views Asked by At

It's about an old application developed with Flex, it's a simple photo capture application. The problem is when I try to load a portrait image, the image is turns around automatically, it doesn't happen with a paysage photo, I think the problem comes from the loading function loader.loadBytes(event.target.data), because I checked the loaded image (DisplayObject) and the height is bigger than width.

I tried to rotate method of the DisplayObject, but it rotate only the object and not the image.

Please find below the code

private function onFileLoaded(event:Event):void
{
    var loader:Loader = new Loader();
    loader.loadBytes(event.target.data);
    fileRef.removeEventListener(Event.COMPLETE, onFileLoaded);
    loader.contentLoaderInfo.addEventListener(Event.COMPLETE, imageLoaded2)
} 
private function imageLoaded(event:Event):void
{
    try
    {
    var loadedContent:DisplayObject=event.target.content;

    var imgBD:BitmapData = new BitmapData(loadedContent.width, loadedContent.height);
    var imgBDHD:BitmapData = new BitmapData(loadedContent.width, loadedContent.height);

    var imgBitmap:Bitmap;
    var imgBitmapHD:Bitmap;

    imgBD.draw(loadedContent);
    imgBDHD.draw(loadedContent);

    imgBitmap=new Bitmap(imgBD);
    imgBitmapHD=new Bitmap(imgBDHD);

    img_uploadHD.source = imgBitmapHD
    img_upload.source = imgBitmap

    pic.visible = false
    btn_snap.visible=false
    img_upload.visible=true
    square_size.visible=true
    v1.visible=true
    btn_voir.visible=true
    btn_reset.visible = true
    btn_parcourir.visible = false
    btn_load_current.visible = false
    nuage()
    }
        catch (error:Error)
    {
        Alert.show("ERROR")
    }
}

Nuage method:

private function nuage():void
{
    //nuage 1
    nuage1.x = 0
    nuage1.y = 0
    nuage1.width = testy.x
    nuage1.height = v1.height

    //nuage 2
    nuage2.x = testy.x
    nuage2.y = 0
    nuage2.width = testy.width
    nuage2.height = testy.y

    //nuage 3
    nuage3.x = testy.x
    nuage3.y = testy.y + testy.height
    nuage3.width = testy.width
    nuage3.height = v1.height -(testy.y + testy.height)

    //nuage 4
    nuage4.x = testy.x + testy.width
    nuage4.y = 0
    nuage4.width = v1.width - (testy.x + testy.width)
    nuage4.height = v1.height
}

Thank you

0

There are 0 answers