【问题标题】:Print selected multiple item from tilelist in flex3打印从 flex3 的 tilelist 中选择的多个项目
【发布时间】:2012-09-01 00:10:19
【问题描述】:
我正在开发 flex 3 项目。其中我有一个 tileList,其中有多个图像,每个图像都放在 tileList 中的不同画布中。我会将 allowmultipleSelection 设为 true。现在我需要在打印按钮单击时打印所有图像,用户从 TileList 中选择。
请给我正确的建议,我会怎么做。
谢谢,
【问题讨论】:
标签:
actionscript-3
apache-flex
printing
actionscript
flex3
【解决方案1】:
我得到了答案在这里,我使用 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%" />