2 Replies Latest reply on Jul 11, 2010 1:30 AM by MikisMM

    Flipped BitmapImage in Flex 4.1 (possible bug)

    MikisMM Level 2

      Hello everyone.

      I'm experiencing strange behaviour of BitmapImage component with Flex 4.1 (more specificly - build Here is a sample application which causes an issue to arise:

      <s:Application creationComplete="this_creationCompleteHandler(event)">
               import components.base.viewport.Viewport;
               import mx.events.FlexEvent;
               import spark.components.Group;
               import spark.primitives.BitmapImage;
               private var imageClass:Class;

               protected function this_creationCompleteHandler(event:FlexEvent):void
                  var container:Group = new Group();
                  var image:BitmapImage = new BitmapImage();
                  image.source = imageClass;

      The problem is that the image is flipped horizontally (and it should not be). This probably have something to do with the bug SDK-26346, which is now closed. In comments I've found a "workaround" for the issue: if we switch places of two last lines of  this_creationCompleteHandler() method (we add container to the display list and only after that we add image to that container) the problem dissapears. However, I must say that version 4.0 of the framework does not suffer from this issue. Moreover, this also does not apply for other components with 4.1 as well (I guess there might be a few others causing the issue but I have tested  this with BitmapImage only).

      So here is my question. Is it illegal to add BitmapImage to any container prior adding that container to the display list (and that effectively means that we have to create children of any component only in createChildren() method and not, for example, in a constructor)? If this is true, then why adding an image to a container before it has been added to the display list worked without any problems until the new version of the framework has been realeased? Or is this a bug introdused by "layout mirroring" feature in 4.1  version of Flex? In that case, I will have to report a bug.


      Thanks in advance,