The text always overlaps the canvas and remains at the top... ??? Am I doing 
something wrong?

var
parentCanvas.percentWidth =100;
parentCanvas.percentHeight = 100;parentCanvas: Canvas = newCanvas();var
childCanvas.percentWidth = 100;
childCanvas.percentHeight = 100;childCanvas: Canvas = newCanvas();var
childText.percentWidth = 100;
childText.text = 
parentCanvas.addChild(childCanvas);
parentCanvas.addChild(childText);
box.addChild(parentCanvas); 
 
box is my mxml component.
 
Thanks.childText:Text = newText();'This is a test';



________________________________
From: sunild999999 <sunilbd...@gmail.com>
To: flexcoders@yahoogroups.com
Sent: Tuesday, February 17, 2009 1:37:28 PM
Subject: [flexcoders] Re: DYNAMIC actionscript child layout.


I think you want something like this:

var parentCanvas: Canvas = new Canvas();
parentCanvas. percentWidth =100;
parentCanvas. percentHeight = 100;

var childCanvas: Canvas = new Canvas();
childCanvas. percentWidth = 100;
childCanvas. percentHeight = 100;

var childText:Text = new Text();
childText.percentWi dth = 100;

parentCanvas. addChild( childCanvas) ;
parentCanvas. addChild( childText) ;

Let the childCanvas be 100% of the height of it's parent. The parent container 
will know to 
leave enough room for childText. I'm not explaining this very well, but the 
above code 
should do what you're looking for.

--- In flexcod...@yahoogro ups.com, - - <sailorsea21@ ...> wrote:
>
> Hi Sunil, this is what I'm trying to replicate in actionscript:
> <mx:Canvasid= "parentCanvas" width="100%" height="100% ">    
<mx:Canvasid= "childCanvas" width="{parentCanva s.width}" 
height="{parentCanv as.height- childText. height}"/ ></mx:Canvas>
> In MXML this layout is DYNAMIC, meaning if I resize my window, all my 
> components are 
also resized... 
>  
> How can I replicate this in actionscript?
>  
> Thank you.
>  
> -David
> 
> 





      

Reply via email to