So the problem remains, when scaling up the graphic drawn inside the
UIComponent, if scaled up enough, it extends beyond the boundaries of
the Panel container.  arrg.... just when I though I had this figured
out.  Here is my code, try it yourself:
 
The MXML:
 
<mx:Panel id="networkBrowserPanel" width="100%" height="100%"
layout="absolute" title="Network" >
       <mx:HBox x="5" y="5">
        <mx:Button label="Zoom In" click="{veniceNetwork.zoomIn()}"/>
        <mx:Button label="Zoom Out" click="{veniceNetwork.zoomOut()}"/>
       </mx:HBox>
       <c:VeniceNetwork container="{networkBrowserPanel}" width="100%"
height="100%"
       outerAlpha="1" innerAlpha="1" outerColor="#ffffff"
innerColor="#4F81BD" />
</mx:Panel> 
 
The component:
 
package components
{
 import mx.core.UIComponent;
 import flash.geom.Rectangle;
 import src.network.NetworkRenderer;
 import mx.controls.Button;
 import flash.display.Sprite;
 
 public class VeniceNetwork 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 dataProvider:Object;
  
  private static const minHeight:int =400;
  private static const minWidth:int = 400;
  
  private var _radius:int = 200;
  private var _middleX:int;
  private var _middleY:int;
  private var _network_sp:Sprite;
  private var _counter:int = 0;
  
  public function VeniceNetwork()
  {
   super();
  }
  
  override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void 
  {
   super.updateDisplayList(unscaledWidth, unscaledHeight); 
   measuredWidth = unscaledWidth;
   measuredHeight = unscaledHeight; 
   render();
  }
  
          override protected function measure():void
          {
           var rect:Rectangle = getBounds(this);
           measuredWidth = rect.width;
   measuredHeight = rect.height;
          }
        
         private function render():void
  {
   graphics.clear();
   _middleX = measuredWidth/2;
   _middleY = measuredHeight/2;
   graphics.lineStyle(borderThickness, outerColor, outerAlpha);
   graphics.beginFill(innerColor, innerAlpha)
   graphics.drawCircle(_middleX, _middleY, _radius);
  }
  
  public function zoomIn():void
  {
   scaleX += .1;
   scaleY += .1;
  }
  
  public function zoomOut():void
  {
   scaleX -= .1;
   scaleY -= .1;
  }
      
 }
}
 

Jason Merrill 
Bank of America 
GT&O L&LD Solutions Design & Development 
eTools & Multimedia 

Bank of America Flash Platform Developer Community 

Reply via email to