我正在开展flex 3项目。其中我有一个tileList,其中有多个图像,每个图像放在tileList中的不同画布中。我将 allowmultipleSelection 设为true。现在我需要打印所有图像打印按钮单击,用户从TileList中选择。
请给我适当的建议,我将如何做。
谢谢,
答案 0 :(得分:0)
我得到了答案在这里,我使用Tile代替TileList,然后将所有选定图像推送到一个数组中。在 printer.printPage 中,我将传递该数组,它现在可以正常工作。
/* MyCustomItemBox */
<mx:HBox id="hb" autoLayout="false">
<mx:Image id="img" source="{imageURL}"/>
</mx:HBox>
/* Print Script */
// Custom Component which will be added in to Tile.
var myCustomBox= new MyCustomItemBox();
thumbView.addChild(myCustomBox);
// On Print Button Click
protected function onPrintPages(event:MouseEvent):void
{
var printer:Printer = new Printer();
var arr:Array = new Array();
for(var i:int = 0;i<10;i++)
{
var bdi:MyCustomItemBox = thumbView.getChildAt(i) as MyCustomItemBox;
var hb:HBox = bdi.getChildByName("hb") as HBox;
arr.push( hb.getChildByName( 'img' ) as UIComponent );
}
if(arr.length > 0)
printer.printPage(arr,null, "showAll");
}
<mx:Tile id="thumbView" autoLayout="false" width="90%" height="90%" />