Flex4: How to add a child to spark Scroller in AS

核能气质少年 提交于 2019-12-25 03:36:05

问题


I want to convert the following code to ActionScript (mxml works fine):

<mx:Panel title="Some Title" width="400" height="300">
  <s:Scroller width="100%" height="100%"/>
    <mx:ColumnChart id="myChart" attribute="..." />

This doesn't work straight forward:

setupChart(); //setup myChart

var scroll:Scroller = new Scroller();
scroll.percentWidth = 100;
scroll.percentHeight = 100;
scroll.viewport = myChart;

回答1:


adding a group first works for me

setupChart();

var grp:Group = new Group();
grp.percentWidth = 100;
grp.percentHeight = 100;
grp.addElement( myChart );

var scroll:Scroller = new Scroller();
scroll.percentWidth = 100;
scroll.viewport = grp;


来源:https://stackoverflow.com/questions/2287431/flex4-how-to-add-a-child-to-spark-scroller-in-as

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!