[flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-18 Thread sunild999999
Doh! Jeffry is right, it's a Canvas which positions child components by x,y 
coordinates.

So use a VBox or HBox or something :)

--- In flexcoders@yahoogroups.com, Jeffry Houser j...@... wrote:

 
   I think that x and y values are defaulted to 0, 0; which would put 
 your text in the top left of the canvas.  The box may layout the canvas, 
 but will not lay out children of the canvas.
 
  This looks like it might be a createChildren method?   I would usually 
 position elements in the updateDisplayList method. 
 






[flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-17 Thread sunild999999
Um, I think you just need to think about this a little differently.

It's a percent value, so by definition it can only be 0-100.

If you want a child component to be half the width of it's parent container, 
then you set 
the child component's width to be 50%... just like you would do in HTML.

If that's not making sense, post some sample code and perhaps I or someone else 
can 
show you how to restructure it to use percent widths/heights.

Sunil



--- In flexcoders@yahoogroups.com, - - sailorse...@... wrote:

 Using the percentWidth and percentHeight, how can I use values other than 
 0-100 ?
 Can I use the width of a component divided by two???
 testlayout.width/2
 How can I accomplish this?
 
 Thanks.
 
 -David





Re: [flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-17 Thread Nathaniel Skiba
Percent width and height are based on the percent of their parent
container's size. Thus, with your example, you'd want:

var graphLayout:Canvas = new Canvas();
graphLayout.percentWidth=50;
graphLayout.percentHeight=50;
testlayout.addChild(graphLayout);   

You could also use constraints, although you have to use a special
method for those, and percents seems to be more along the lines of what
you're looking for anyway.

~Nate


Re: [flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-17 Thread - -
Hi Sunil, this is what I'm trying to replicate in actionscript:
mx:Canvasid=parentCanvas width=100% height=100%    
mx:Canvasid=childCanvas width={parentCanvas.width} 
height={parentCanvas.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





From: sunild99 sunilbd...@gmail.com
To: flexcoders@yahoogroups.com
Sent: Tuesday, February 17, 2009 3:55:39 AM
Subject: [flexcoders] Re: DYNAMIC actionscript child layout.


Um, I think you just need to think about this a little differently.

It's a percent value, so by definition it can only be 0-100.

If you want a child component to be half the width of it's parent container, 
then you set 
the child component's width to be 50%... just like you would do in HTML.

If that's not making sense, post some sample code and perhaps I or someone else 
can 
show you how to restructure it to use percent widths/heights.

Sunil

--- In flexcod...@yahoogro ups.com, - - sailorsea21@ ... wrote:

 Using the percentWidth and percentHeight, how can I use values other than 
 0-100 ?
 Can I use the width of a component divided by two???
 testlayout. width/2
 How can I accomplish this?
 
 Thanks.
 
 -David


    mx:Textid=childText width={parentCanvas.width} bottom=0 
text=test/ 


  

[flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-17 Thread sunild999999
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.percentWidth = 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 flexcoders@yahoogroups.com, - - sailorse...@... wrote:

 Hi Sunil, this is what I'm trying to replicate in actionscript:
 mx:Canvasid=parentCanvas width=100% height=100%    
mx:Canvasid=childCanvas width={parentCanvas.width} 
height={parentCanvas.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
 
 




Re: [flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-17 Thread - -
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: sunild99 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
 
 





  

Re: [flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-17 Thread Jeffry Houser


 I think that x and y values are defaulted to 0, 0; which would put 
your text in the top left of the canvas.  The box may layout the canvas, 
but will not lay out children of the canvas.


This looks like it might be a createChildren method?   I would usually 
position elements in the updateDisplayList method. 



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

* *

*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.percentWidth = 100;

childText.text = *'This is a test'*;

parentCanvas.addChild(childCanvas);

parentCanvas.addChild(childText);

box.addChild(parentCanvas);

 


box is my mxml component.

 


Thanks.



*From:* sunild99 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 
mailto:flexcoders%40yahoogroups.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










--
Jeffry Houser, Technical Entrepreneur
Adobe Community Expert: http://tinyurl.com/684b5h
http://www.twitter.com/reboog711  | Phone: 203-379-0773
--
Easy to use Interface Components for Flex Developers
http://www.flextras.com?c=104
--
http://www.theflexshow.com
http://www.jeffryhouser.com
--
Part of the DotComIt Brain Trust



Re: [flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-16 Thread - -
Using the percentWidth and percentHeight, how can I use values other than 0-100 
?
Can I use the width of a component divided by two???
testlayout.width/2
How can I accomplish this?

Thanks.

-David





From: sunild99 sunilbd...@gmail.com
To: flexcoders@yahoogroups.com
Sent: Monday, February 16, 2009 1:46:46 AM
Subject: [flexcoders] Re: DYNAMIC actionscript child layout.


In Actionscript, you can use the percentWidth and percentHeight 
properties to specify width and height of your components.

--- In flexcod...@yahoogro ups.com, sailorsea21 sailorsea21@ ... 
wrote:

 Hi everyone, when I create my layout with mxml components, my 
layout is 
 dynamic. If I resize my browser window, my components are also 
resized.
 How can I achieve this in actionscript using addChild???
 
 var Layout:Canvas = new Canvas();
 graphLayout. width=testlayout .width/2;
 graphLayout. height=testlayou t.width/2;
 layout_graphs. addChild( graphLayout) ; 
 
 testlayout is my vbox that will be parent to the canvas.
 
 Thanks.






  

[flexcoders] Re: DYNAMIC actionscript child layout.

2009-02-15 Thread sunild999999
In Actionscript, you can use the percentWidth and percentHeight 
properties to specify width and height of your components.


--- In flexcoders@yahoogroups.com, sailorsea21 sailorse...@... 
wrote:

 Hi everyone, when I create my layout with mxml components, my 
layout is 
 dynamic. If I resize my browser window, my components are also 
resized.
 How can I achieve this in actionscript using addChild???
 
   var Layout:Canvas = new Canvas();
   graphLayout.width=testlayout.width/2;
   graphLayout.height=testlayout.width/2;
   layout_graphs.addChild(graphLayout);
 
 testlayout is my vbox that will be parent to the canvas.
 
 Thanks.