I have some code that when I use a Sprite the width and height values ares set when using addChild but when using a SpriteVisualElement the width and height are 0.
var sprite:Sprite = new Sprite();
// ...
sprite.cacheAsBitmap = true;
sprite.transform.matrix = target.transform.matrix;
sprite.addChild(bitmap); // width and height 250x65
var spritevisualElement:SpriteVisualElement = new SpriteVisualElement();
// ...
spriteVisualElement.cacheAsBitmap = true;
spriteVisualElement.transform.matrix = target.transform.matrix;
spriteVisualElement.addChild(bitmap); // spriteVisualElement width and height 0x0
What is going on? Can I make SpriteVisualElement work?
You can use bounds for the actual size (btw
SpriteVisualElementuses bounds as well when measures itself in themeasuremethod, but by some reasonsmeasureisn’t called by flex automatically and there isn’t way (I can’t find it) to call it manually):output: