[
https://issues.apache.org/jira/browse/FLEX-34816?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14389548#comment-14389548
]
Lee Burrows commented on FLEX-34816:
------------------------------------
You need to add the Label to the stage and wait for it to render before there
is anything to capture.
replace:
bmData = BitmapUtil.getSnapshotWithPadding(lbl,6,false,new
Rectangle(0,0,250,50));
with this:
addElement(lbl); //add to stage
lbl.validateNow(); //force it to render immediately
bmData = BitmapUtil.getSnapshotWithPadding(lbl,6,false,new
Rectangle(0,0,250,50)); //take snapshot
removeElement(lbl); //remove from stage
> BitmapUtil.getSnapshot not working
> ----------------------------------
>
> Key: FLEX-34816
> URL: https://issues.apache.org/jira/browse/FLEX-34816
> Project: Apache Flex
> Issue Type: Bug
> Affects Versions: Apache Flex 4.13.0
> Environment: OSX Yosemite.
> Adobe Air project
> Reporter: Silvio Liria
>
> The getSnapshotWithPadding method does not work.
> It doesn't show any error but the image is never drawn,
> I have this problem also with ImageSnapshot.captureBitmapData(lbl)
> <fx:Script>
> <![CDATA[
> import mx.core.IVisualElement;
> import mx.core.UIComponent;
> import mx.events.FlexEvent;
> import mx.graphics.ImageSnapshot;
>
> import spark.components.Application;
> import spark.components.Button;
> import spark.components.Group;
> import spark.components.Image;
> import spark.components.Label;
> import spark.utils.BitmapUtil;
>
> import models.Colors;
> import models.Icons;
> import models.TrailbackMapaIcons;
>
> private var pi:positionIcon
>
>
> protected function
> container_creationCompleteHandler(event:FlexEvent):void
> {
> var lbl:Label = new Label()
> lbl.text = 'testing...';
> lbl.width = 200
> lbl.height = 25
> var bmData:BitmapData;
> bmData =
> BitmapUtil.getSnapshotWithPadding(lbw,6,false,new Rectangle(0,0,250,50))
> var b:Bitmap = new Bitmap(bmData)
> var img:Image = new Image()
> img.source = b
> img.width = img.height = 25
>
> container.source = img.source;
> }
> ]]>
> </fx:Script>
> <s:Image id="container" width="100%" height="100%"
> creationComplete="container_creationCompleteHandler(event)"/>
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)