开发者

How do I manipulate layout of spark/mx components via actionscript?

开发者 https://www.devze.com 2023-02-08 17:29 出处:网络
I know I can create an actionscript loop in a script block that can create an array of objects. The problem is when doing that I don\'t know how to have those objects interact with the overall layout

I know I can create an actionscript loop in a script block that can create an array of objects. The problem is when doing that I don't know how to have those objects interact with the overall layout structure of the mxml document itself. They just default to 0,0. What If I wanted to arrange a loop of dynamically generated objects inside of a tilegroup and under another dynamically generated item using actionscript for instance? (without individually specifyin x&y)

I need to know how to give them an automatic lay开发者_C百科out (like horizontal) and then determine where they fall in the order of other objects declared via mxml?


You can just add them as elements to the container group of your choice, just use:

myVGroup.addElement( myComponent );

Inside your loop. Where myVGroup is a VGroup that already exists in your layout.

You may also find this of interest. http://evtimmy.com/2009/06/flowlayout-a-spark-custom-layout-example/

0

精彩评论

暂无评论...
验证码 换一张
取 消