<?xml version="1.0" encoding="utf-8"?>
<mx:WindowedApplication xmlns:mx="http://www.adobe.com/2006/mxml"
layout="vertical"
creationComplete="OnInit();" width="100%" height="100%">
<mx:Script>
<![CDATA[
import mx.controls.Image;
import mx.controls.Alert;
import mx.collections.ArrayCollection;
[Bindable]
private var listfiles:ArrayCollection=new
ArrayCollection();
private function OnInit():void{
var desktop:File = File.desktopDirectory;
var desktop:File =
File.desktopDirectory.resolvePath("barcode");
var getfiles:Array =
desktop.getDirectoryListing();
//Push all thi values to the Arraycollection
to be diaplayed in the
list//
for (var i:int = 0; i < getfiles.length; i++)
{
listfiles.addItemAt((getfiles[i].nativePath), i);
}
}
[Bindable]
private var arrImage:Array = new Array();
private function handleDIR(event:FileListEvent):void{
for each(var afile:File in event.files){
if(afile.extension == 'png'){
var aImg:Image = new Image();
aImg.source = afile.nativePath;
arrImage.push(aImg);
}
}
}
/* PRINT FUNCTION */
import mx.printing.*;
private function printData():void {
// Create an instance of the
FlexPrintJob class.
var printJob:FlexPrintJob = new FlexPrintJob();
// Start the print job.
if (printJob.start() != true) return;
// Add the object to print. Do not scale it.
printJob.addObject(displayimg,
FlexPrintJobScaleType.NONE);
// Send the job to the printer.
printJob.send();
}
]]>
</mx:Script>
<mx:Button label="Print" click="printData();" />
<mx:TileList id="displayimg" dataProvider="{listfiles}"
borderThickness="2" borderColor="gray"
itemRenderer="mx.controls.Image" rowHeight="56" columnWidth="85"
width="100%" height="100%" >
</mx:TileList>
</mx:WindowedApplication>
But only visible images r printed, can we print whole images assign
to tilelist ?
thx in advanced,
:)