![]() |
![]() |
||||||
|
|||||||
| Tags: added, container, content, dynamic, getting, height |
![]() |
|
|||
|
Hello,
I'm having issues getting a containers height after adding content to that container. The code below shows you what I'm trying to do. I have tried to validate the container and still get a 0 in height. Is there a reason why this is happening because from my point of view, after I add an object to the container the height of the container should change. Please help. <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" creationComplete="init()" applicationComplete="check()"> <mx:Script> <![CDATA[ import mx.containers.VBox; import flash.utils.setInterval; import mx.controls.Text; private var txt:Text = new Text(); private var vBox:VBox = new VBox(); private function init():void { txt.text = "Hello World"; vBox.addChild(txt); this.addChild(vBox); } private function check():void { setInterval(trace, 100, vBox.height); } ]]> </mx:Script> </mx:Application> |
| Sponsored Links |
|
|||
|
Probably has to do with the fact you are calling check() in
applicationComplete, as this code works: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" creationComplete="init()"> <mx:Script> <![CDATA[ import mx.containers.VBox; import flash.utils.setInterval; import mx.controls.Text; private var txt:Text = new Text(); private var vBox:VBox = new VBox(); private function init():void { txt.text = "Hello World"; vBox.addChild(txt); this.addChild(vBox); } private function check():void { setInterval(trace, 100, vBox.height); } ]]> </mx:Script> <mx:Button label="Check Size" click="check()"/> </mx:Application> |
![]() |
| Thread Tools | |
| Display Modes | |
|
|
- Contact Us
-|-
Adobe Dreamweaver Forums -|-
Archive -|-
Top -|-Rules/Disclaimer-|-Help/Support-|-Advertise