Does this work for you?

<?xml version="1.0" encoding="utf-8"?>
<s:Group xmlns:fx="http://ns.adobe.com/mxml/2009";
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
width="100%"
height="100%">
<fx:Script>
<![CDATA[
import mx.graphics.GradientEntry;
import mx.graphics.LinearGradient;
import mx.graphics.SolidColor;
import mx.graphics.SolidColorStroke;
import spark.primitives.Rect;
public var traceWidth:Boolean = false;
private var needsUpdate:Boolean;

public var _fillRect:Rect;
private var _solidStrokeColor:SolidColorStroke;
private var _linearGradient:LinearGradient;
private var _gradientEntry1:GradientEntry;
private var _gradientEntry2:GradientEntry;

private var _radiusX:int = 0;
public function set radiusX(value:int):void
{
_radiusX = value;
needsUpdate = true;
invalidateProperties();
}

private var _radiusY:int = 0;
public function set radiusY(value:int):void
{
_radiusY = value;
needsUpdate = true;
invalidateProperties();
}

private var _gradientRotation:int = 90;
public function set gradientRotation(value:int):void
{
_gradientRotation = value;
needsUpdate = true;
invalidateProperties();
}

private var _gradientFill01:uint = 0xEFEFEF;
public function get gradientFill01():uint
{
return _gradientFill01;
}
public function set gradientFill01(value:uint):void
{
_gradientFill01 = value;
needsUpdate = true;
invalidateProperties();
}

private var _gradientFill02:uint = 0xEFEFEF;
public function get gradientFill02():uint
{
return _gradientFill02;
}
public function set gradientFill02(value:uint):void
{
_gradientFill02 = value;
needsUpdate = true;
invalidateProperties();
}

private var _gradientFill01Alpha:Number = 1;
public function get gradientFill01Alpha():Number
{
return _gradientFill01Alpha;
}
public function set gradientFill01Alpha(value:Number):void
{
_gradientFill01Alpha = value;
needsUpdate = true;
invalidateProperties();
}

private var _gradientFill02Alpha:Number = 1;
public function get gradientFill02Alpha():Number
{
return _gradientFill02Alpha;
}
public function set gradientFill02Alpha(value:Number):void
{
_gradientFill02Alpha = value;
needsUpdate = true;
invalidateProperties();
}

private var _strokeColor:uint = 0xEEEEEE;
public function get strokeColor():uint
{
return _strokeColor;
}
public function set strokeColor(value:uint):void
{
_strokeColor = value;
needsUpdate = true;
invalidateProperties();
}

private var _strokeAlpha:Number = 1;
public function get strokeAlpha():Number
{
return _strokeAlpha;
}
public function set strokeAlpha(value:Number):void
{
_strokeAlpha = value;
needsUpdate = true;
invalidateProperties();
}

private var _strokeWeight:Number = 1;
public function get strokeWeight():Number
{
return _strokeWeight;
}
public function set strokeWeight(value:Number):void
{
_strokeWeight = value;
needsUpdate = true;
invalidateProperties();
}

private var _trbl:Object = { t:0, r:0, b:0, l:0 };
public function set trbl(value:Array):void
{
if(!isNaN(value[0]))
{
_trbl.t = value[0];
}

if(!isNaN(value[1]))
{
_trbl.r = value[1];
}

if(!isNaN(value[2]))
{
_trbl.b = value[2];
}

if(!isNaN(value[3]))
{
_trbl.l = value[3];
}
needsUpdate = true;
invalidateProperties();
}

override protected function createChildren():void
{
super.createChildren();
_fillRect = new Rect();
_fillRect.left = _fillRect.right = _fillRect.top = _fillRect.bottom = 0;
_fillRect.fill = new SolidColor(0xFF0000);
_fillRect.stroke = new SolidColorStroke(0x00FF00,2);
addElement(_fillRect);
}
override protected function commitProperties():void {
super.commitProperties();
if(needsUpdate) {
needsUpdate = false;
try {
_linearGradient = new LinearGradient();
_gradientEntry1 = new GradientEntry(_gradientFill01, 0,
_gradientFill01Alpha);
_gradientEntry2 = new GradientEntry(_gradientFill02, .5,
_gradientFill02Alpha);
_linearGradient.entries = [_gradientEntry1, _gradientEntry2];
_linearGradient.rotation = _gradientRotation;
_fillRect.fill = _linearGradient;
_fillRect.radiusX = _radiusX;
_fillRect.radiusY = _radiusY;
_solidStrokeColor = new SolidColorStroke(_strokeColor, _strokeWeight,
_strokeAlpha);
_fillRect.stroke = _solidStrokeColor;
invalidateDisplayList();
} catch (e:Error) {
trace(e.message);
}
}
}
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void {
super.updateDisplayList(unscaledWidth, unscaledHeight);
}
]]>
</fx:Script>
</s:Group>


On Tue, Oct 18, 2016 at 12:31 PM, kamcknig <kamck...@gmail.com> wrote:

> I think it has something to do with the fact that I'm setting the
> measuredMinWidth in the measure() method. So when sizing down, it's looking
> at the measuredMinWidth and it can't size it down below that. But if I take
> that out then my app runs forever. And continues to grow in width/height
> non-stop and i have to end the process to get it to stop updating
>
>
>
> --
> View this message in context: http://apache-flex-users.
> 2333346.n4.nabble.com/Can-t-get-custom-component-to-size-
> down-properly-tp13841p13842.html
> Sent from the Apache Flex Users mailing list archive at Nabble.com.
>

Reply via email to