views:

459

answers:

1

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  A: 

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;
andreas
group is IViewport, which Scroller requires :)
viatropos