我正在开发 flex 3 项目。其中我有一个 tileList,其中有多个图像,每个图像都放在 tileList 中的不同画布中。我会将allowmultipleSelection 设置为true。现在我需要在打印按钮单击时打印所有图像,用户从 TileList 中选择。
请给我适当的建议,我将如何做。
谢谢,
我正在开发 flex 3 项目。其中我有一个 tileList,其中有多个图像,每个图像都放在 tileList 中的不同画布中。我会将allowmultipleSelection 设置为true。现在我需要在打印按钮单击时打印所有图像,用户从 TileList 中选择。
请给我适当的建议,我将如何做。
谢谢,
我得到了答案 在这里,我使用 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%" />