[flexcoders] Problem dynamically creating text controls

2005-11-02 Thread pasflex
We have an application where we are dynamically creating various 
controls in containers in a viewstack.  If a text control is created 
in a non-visible layer of the viewstack, the height of the control 
is not correct.  This only happens for text controls in 1.5.  It 
does not seem to happen in 2.0.  Is this a bug or is there something 
we are missing?

Thanks

Here is some code that demonstrates the problem:

?xml version=1.0 encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml; 
creationComplete=initLayout()
mx:Panel width=250 height=300
mx:ViewStack id=vs width=100% height=100%
mx:VBox id=vb1 width=100% 
height=100%/mx:VBox
mx:VBox id=vb2 width=100% 
height=100%/mx:VBox
/mx:ViewStack
/mx:Panel
mx:Script
![CDATA[
var textArray = new Array(The quick brown fox 
jumped over the lazy dog,

  The quick brown fox jumped over the lazy dog,

  The quick brown fox jumped over the lazy dog);
function initLayout():Void {
for (var i=0; itextArray.length; i++) {
vb1.createChild
(mx.controls.Text, , {text:textArray[i], width:100%});
vb2.createChild
(mx.controls.Text, , {text:textArray[i], width:100%});
}
var vb1Button = vb1.createChild
(mx.controls.Button,, {label:vbox 2, id:button1});
vb1Button.addEventListener(click, this);
var vb2Button = vb2.createChild
(mx.controls.Button,, {label:vbox 1, id:button2});
vb2Button.addEventListener(click, this);
}

function handleEvent(event:Object):Void {
if( event.type == click ) {
if (event.target.id = button1) {
vs.selectedIndex = 1;
}
if (event.target.id = button2) {
vs.selectedIndex = 0;
}
}
}
]]
/mx:Script
/mx:Application






 Yahoo! Groups Sponsor ~-- 
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/nhFolB/TM
~- 

--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com 
Yahoo! Groups Links

* To visit your group on the web, go to:
http://groups.yahoo.com/group/flexcoders/

* To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]

* Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/
 




RE: [flexcoders] Problem dynamically creating text controls

2005-11-02 Thread Matt Chotin










What happens if you set creationPolicy=all
on the view stack? Maybe the height it messed up because the VBox was not
really ready to accept children?











From: flexcoders@yahoogroups.com [mailto:flexcoders@yahoogroups.com] On Behalf Of pasflex
Sent: Wednesday, November 02, 2005
2:30 PM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Problem
dynamically creating text controls





We have an application where we are dynamically creating various 
controls in containers in a viewstack. If a
text control is created 
in a non-visible layer of the viewstack, the
height of the control 
is not correct. This only happens for text
controls in 1.5. It 
does not seem to happen in 2.0. Is this a
bug or is there something 
we are missing?

Thanks

Here is some code that demonstrates the problem:

?xml version=1.0
encoding=utf-8?
mx:Application xmlns:mx=http://www.macromedia.com/2003/mxml

creationComplete=initLayout()
 mx:Panel
width=250 height=300

 mx:ViewStack id=vs
width=100% height=100%

  mx:VBox
id=vb1 width=100% 
height=100%/mx:VBox

  mx:VBox
id=vb2 width=100% 
height=100%/mx:VBox

 /mx:ViewStack
 /mx:Panel
 mx:Script
 ![CDATA[

 var textArray = new Array(The quick brown
fox 
jumped over the lazy dog,

 
 
  
  The
quick brown fox jumped over the lazy dog,

 
 
  
  The
quick brown fox jumped over the lazy dog);

 function initLayout():Void {

  for (var i=0;
itextArray.length; i++) {

 
 vb1.createChild
(mx.controls.Text, ,
{text:textArray[i], width:100%});

  
vb2.createChild
(mx.controls.Text, ,
{text:textArray[i], width:100%});

  }

  var vb1Button =
vb1.createChild
(mx.controls.Button,,
{label:vbox 2, id:button1});

 
vb1Button.addEventListener(click, this);

  var vb2Button =
vb2.createChild
(mx.controls.Button,,
{label:vbox 1, id:button2});

 
vb2Button.addEventListener(click, this);

 }

 

 function handleEvent(event:Object):Void {

  if( event.type ==
click ) {

 
 if (event.target.id = button1) {

 
  vs.selectedIndex
= 1;

 
 }

 
 if (event.target.id = button2) {
 
 
 vs.selectedIndex = 0;

 
 }

  }

 }
 ]]
 /mx:Script
/mx:Application












--
Flexcoders Mailing List
FAQ: http://groups.yahoo.com/group/flexcoders/files/flexcodersFAQ.txt
Search Archives: http://www.mail-archive.com/flexcoders%40yahoogroups.com








  
  
SPONSORED LINKS
  
  
  

Web site design development
  
  
Computer software development
  
  
Software design and development
  
  


Macromedia flex
  

   
  







  
  
  YAHOO! GROUPS LINKS



  Visit your group "flexcoders" on the web.
  To unsubscribe from this group, send an email to:[EMAIL PROTECTED]
  Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.