OK, thanks, I have knocked this down to it's simplest form. The graphic
appears in the right spot, but it does not respond to changes in the
panel's size change. I'm not sure how to implement that in my component.
I'm passing in a reference to the Panel container, but it's not
responding to it's width and height - I tried adding a listener to the
panel's updateComplete event, but when I reference the panel, I get an
error saying I cannot assign to a null property. I took that code out,
see the rest below:
<mx:Panel id="networkBrowserPanel" width="100%" height="100%"
layout="absolute" title="Network" >
<c:NetworkLayout container="{networkBrowserPanel}"
outerAlpha="1" innerAlpha="1" outerColor="#ffffff"
innerColor="0x666666" circleRadius="20" />
</mx:Panel>
package components
{
import mx.core.UIComponent;
import flash.geom.Rectangle;
public class NetworkLayout extends UIComponent
{
public var container:UIComponent;
public var borderThickness:int;
public var outerColor:uint;
public var innerColor:uint;
public var outerAlpha:int;
public var innerAlpha:int;
public var circleRadius:int;
public function NetworkLayout()
{
super();
}
override protected function commitProperties():void
{
drawCircle();
}
private function drawCircle():void
{
graphics.clear();
var thisWidth:int = measuredWidth;
var thisHeight:int = measuredHeight;
var middleX:int = thisWidth/2;
var middleY:int = thisHeight/2;
graphics.lineStyle(borderThickness, outerColor, outerAlpha);
graphics.beginFill(innerColor, innerAlpha)
graphics.drawCircle(middleX, middleY, circleRadius);
}
override protected function measure():void
{
var rect:Rectangle = getBounds(container);
measuredWidth = rect.width;
measuredHeight = rect.height;
}
}
}
Jason Merrill
Bank of America
GT&O L&LD Solutions Design & Development
eTools & Multimedia
Bank of America Flash Platform Developer Community