1 Reply Latest reply on Jul 26, 2010 12:03 PM by chris.campbell

    Screen goes blank while zooming on an image


      I have an application which allows user to view different images and allows to zoom them. Currently I am facing a problem when the size of the scaled image increases from 8181 it shows blank, while the documentation states that maximum size allowed is 8192 pixels.


      I have another observation that if the image is near to square in size, this value reduces to 8060.


      Image with normal zoom



      image with max zoom as calculated by below formula


      max = 8190 / this.image1.content.width, 8190 / this.image1.content.height;




      Am i doing something wrong ?


      here is a sample mxml file which allows you to load images and allows you to scale them.



      <?xml version="1.0" encoding="utf-8"?>

      <mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="windowedapplication1_creationCompleteHandler(event)">




      import mx.core.Application;

      import mx.events.FlexEvent;

      import mx.events.SliderEvent;

      import mx.utils.SecurityUtil;

      private var f : File;


      protected function button1_clickHandler(event:MouseEvent):void


      f = new File();

      var imagesFilter:FileFilter = new FileFilter("Images", "*.jpg;*.gif;*.png");

      f.addEventListener(Event.SELECT, onFileSelect, false, 0 , true);


      f.browseForOpen("Open Image", [imagesFilter]);



      private function onFileSelect(e : Event) : void



      this.image1.scaleX = this.image1.scaleY = this.slider1.value = 1;

      this.text1.text = "1";

      this.image1.source = f.url;





      protected function slider1_changeHandler(event:SliderEvent):void


      this.image1.scaleX = event.value;

      this.image1.scaleY = event.value;

      this.text1.text = event.value.toPrecision(5);



      protected function image1_completeHandler(event:Event):void


      var max : Number = 25; //(4096 * 4096) / (this.image1.content.width * this.image1.content.height); // calculate zoom wrt pixels

      max = Math.min(max, 8190 / this.image1.content.width, 8190 / this.image1.content.height);

      this.slider1.maximum = max;

      this.slider1.minimum = 1;





      protected function textinput1_changeHandler(event:Event):void


      this.image1.scaleX = this.image1.scaleY = this.slider1.value = Number(this.text1.text);




      protected function windowedapplication1_creationCompleteHandler(event:FlexEvent):void


      var c : LoaderContext = new LoaderContext(true, ApplicationDomain.currentDomain);

      this.image1.loaderContext = c;






      <mx:HBox x="0" y="0" width="100%">

      <mx:Text text="Zoom"/>

      <mx:TextInput width="79" change="textinput1_changeHandler(event)" id="text1" text="1"/>

      <mx:HSlider height="100%" id="slider1" change="slider1_changeHandler(event)"/>

      <mx:Button label="Load" click="button1_clickHandler(event)"/>



      <mx:Canvas x="10" y="30" width="100%" height="100%" horizontalScrollPolicy="auto" verticalScrollPolicy="auto">

      <mx:Image id="image1" scaleContent="false" complete="image1_completeHandler(event)"/>




        • 1. Re: Screen goes blank while zooming on an image
          chris.campbell Adobe Employee


          I ran into something similiar to this recently and wanted to let you know what I found.  In my testing, the max image dimension was 8191 (off by 1 in the docs.)  I also saw the following in our BitmapData documentation:


          In AIR 1.5 and Flash Player 10, the maximum size for a BitmapData object is 8,192 pixels in width or height, and the total number of pixels cannot exceed 16,777,216 pixels. (So, if a BitmapData object is 8,192 pixels wide, it can only be 2,048 pixels high.) In Flash Player 9 and earlier and AIR 1.1 and earlier, the limitation is 2,880 pixels in height and 2,880 in width.


          Is it possible that your pixel count has gone over the max number?  I've also found the behavior the same between AIR and Flash Player, which leads me to believe this isn't AIR specific.  If you believe Flash has a bug here, do you mind entering a bug in Jira?