I'm attempting to make an Organization Chart component for Flex. In short, I 
have a canvas which contains child panels These child panels represent a 
position in the organization.  I'm drawing lines (on the canvas) between the 
panels to represent their relationship to each other.

Everything works great until I scroll the canvas. The lines are not drawn in 
relationship to their position in the canvas, but stay were they are in 
relation to the screen. For example, if I scroll down, the panels move up as 
they should, but the lines stay where they are which breaks the "connections". 
I'd like to have them scroll upwards like the panels do.

Due to my lack of experience with flash (and any graphics programming for that 
matter), I may be ramming a square peg in a round hole. Here's the panel code 
which recursively draws its lines to its child panels:

            public function drawLinesToChildren(canvas:HierarchyCanvas):void {  
      
                var startPoint:Point = new Point(x + (width / 2), y + height); 
//  adjust to bottom/center of the parent panel
                for (var i:int = 0; i < children.length; i++) {                
                    var child:HierarchyPanel = children[i];
                    var endPoint:Point = new Point(child.x, child.y);
                    endPoint = new Point(endPoint.x + (child.width / 2), 
endPoint.y); // adjust top/center of the child panel
                    canvas.graphics.moveTo(startPoint.x, startPoint.y);    
                    canvas.graphics.lineTo(endPoint.x, endPoint.y);    
                    child.drawLinesToChildren(canvas);
                }    
            }

If anyone could offer any suggestions, I'd be very grateful.

Reply via email to