2010-02-18 56 views
0

我想下面的代碼轉換爲ActionScript(MXML正常工作):FLEX4:如何添加子引發滾輪在AS

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

這並不直截了當工作:

setupChart(); //setup myChart 

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

回答

3

第一添加組對我的作品

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; 
+0

組IViewport,其中滾輪需要:) – 2010-02-18 11:11:15